0

I am practicing with the SurveyMonkey API. In the documentation (https://developer.surveymonkey.com/api/v3/?python#collectors-id-responses-bulk), they have the following code:

import requests

s = requests.session()
s.headers.update({
  "Authorization": "Bearer %s" % YOUR_ACCESS_TOKEN,
  "Content-Type": "application/json"
})

url = "https://api.surveymonkey.com/v3/surveys/%s/responses/bulk" % (survey_id)
s.get(url, params=payload)

But when I try to recreate it (below) my code doesn't know what payload is defined as. Which actually makes sense to me, but why doesn't the documentation have any sort of definition?

s = requests.Session()

s.headers.update ({
    "Authorization": "Bearer %s" % api_token,
    "Content-Type": "application/json"
})


HOST = "https://api.surveymonkey.com/v3/surveys/%s/responsesbulk" % (survey_id)

s.get(HOST, params=payload)

I don't know how to define it if I just want all the responses from the survey, and I thought the documentation would show me, but it hasn't.

4

1 回答 1

1

in the docs payload is defined in the example for this endpoint

EDIT: So you need to create a JSON (a dict) with the desired Optional Query Strings for GET method of the endpoint.


于 2018-12-22T20:30:21.653 回答