Using Java for calling Management APIs.

Not applicable

I am using Java for calling Management REST APIs and this will lead to getting different type of responses as per the request made like API Proxy, API Product etc. Which means the JSON I'll get will be different for different responses and if I have to get this into an Object I'll have to write my custom Objects. I wanted to know if there is any other way to achieve this, may be some library provided by Apigee for doing this in JAVA etc.

Thank you.

2 2 827
2 REPLIES 2

Dear @Amol Pujari ,

Welcome to Apigee Community.

I believe you are looking for something like Apigee Edge Management API SDK for Java. Unfortunately, As far as i know, At this point of time we don't have one. But, We do have Node.JS SDK & PHP SDK for Apigee Management API. Please find links for same below.

https://github.com/apigee/edge-php-sdk

https://github.com/apigee/ApigeeEdge-Node-SDK

As @Anil Sagar tells you, there is no "Apigee Edge Management API SDK for Java" today.

But, you do not need to write custom objects. Java has JSON libraries such as Jackson which de-serialize JSON payloads into Maps. You can walk through the response using the map.get("key") syntax. Not as clean as a custom Java object, but much easier; there's no need to write all those custom classes.

deserializing from arbitrary JSON into a map with the Jackson Jar looks like this:

ObjectMapper mapper = new ObjectMapper();
String json = "{\"name\":\"mkyong\", \"age\":29}";

Map<String, Object> map = new HashMap<String, Object>();

// convert JSON string to Map
map = mapper.readValue(json, new TypeReference<Map<String, String>>(){});

(Thanks to mykong for the snippet.)