API Call to Account Info Returning NULL


API Call to Account Info Returning NULL

Hi, I am using the following URL to bring back my Account Information => https://api.constantcontact.com/v2/account/info?api_key=myAPIKey This works fine when I run it from SOAPUI, or directly from the browser, however when I run it from my Java program I get a NULL response. Following is my Java code.. RestTemplate restTemplate = new RestTemplate(); ResultSet rsAcctInfo1 = restTemplate.getForObject("https://api.constantcontact.com/v2/account/info?api_key=myAPIKey&access_token=myAccessToken", ResultSet.class); String strAcctInfoJSON = rsAcctInfo1.toJSON(); System.out.println(strAcctInfoJSON); RestTemplate is from the Spring Framework. I can call other API's in Constant Contact with Spring, and it works fine. Any help would be appreciated. Thanks, Dave

Hi Dave,


Based on what you're trying to do here, it looks like the problem is that you're trying to map the response from this API endpoint to the ResultSet class. I expect that this map is failing, because this endpoint returns a single object, with a set of properties containing information about the account.  You can see an example of the class we use in our Java SDK for mapping the response from this endpoint here: https://github.com/constantcontact/java-sdk/blob/master/src/main/java/com/constantcontact/components...


If that doesn't solve the problem, please let us know!



Elijah G.
API Support Engineer
Developer Portal

View API documentation, code samples, get your API key.

Visit Page