我已经编写了一个java代码来获取调查列表,然后从我的帐户中获取这些调查的详细信息。我可以使用相同的API密钥获取调查ID列表,但不能获得调查的详细信息。
这是构建的网址:
https://api.surveymonkey.net/v2/surveys/get_survey_details/?api_key=---API-KEY--- --data-binary '{"survey_id":"---SURVEY-ID---"}'
错误:
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---"}'
连接设置为发布请求:
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();
}
}
如果我在浏览器中尝试使用URL,则会显示:
This XML file does not appear to have any style information associated with it. The document tree is shown below.
<h1>Developer Inactive</h1>
请注意,第一个查询使用提供的相同api密钥和访问令牌正常执行。