0

我编写了一个 java 代码来获取调查列表,然后从我的帐户中获取这些调查的详细信息。我可以使用相同的 API 密钥获取调查 ID 列表,但不能获取调查的详细信息。

这是构造的url:

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 密钥和访问令牌执行良好。

4

0 回答 0