I've written a java code to get survey list and then details of those surveys from my account. I am able to get the list of survey IDs but not the details of the survey, using the same API key.
Here's the url constructed:
https://api.surveymonkey.net/v2/surveys/get_survey_details/?api_key=---API-KEY--- --data-binary '{"survey_id":"---SURVEY-ID---"}'
Error:
Server returned HTTP response code: 400 for URL: https://api.surveymonkey.net/v2/surveys/get_survey_details/?api_key=---API-KEY--- --data-binary '{"survey_id":"---SURVEY-ID---"}'
The connection is setup as a post request:
private void resetConnection(String url){
URL ourl;
try {
ourl = new URL(url.toString());
conn = (HttpURLConnection) ourl.openConnection();
conn.setRequestMethod("POST");
conn.setRequestProperty("Authorization", "bearer " + SurveyMonkeyUrl.accessToken);
conn.setRequestProperty("Content-Type", "application/json");
} catch (Exception e) {
e.printStackTrace();
}
}
If I try the URL in the browser it shows:
This XML file does not appear to have any style information associated with it. The document tree is shown below.
<h1>Developer Inactive</h1>
Note that the first query is executing fine with the provided same api key and access token.