Skip to content

Instantly share code, notes, and snippets.

@santina
Created November 16, 2016 19:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save santina/672f5b57f708af0763adb4b5ead45af2 to your computer and use it in GitHub Desktop.
Save santina/672f5b57f708af0763adb4b5ead45af2 to your computer and use it in GitHub Desktop.
s = requests.session()
s.headers.update({
"Authorization": "Bearer %s" % ACCESS_TOKEN,
"Content-Type": "application/json"
})
page_id = "0000000"
survey_id = "111111"
payload = {
"headings": [
{
"random_assignment": {
"position": 1,
"percent": 50
},
"heading": "Multiple Choice with Random Assignment v1"
},
{
"random_assignment": {
"position": 2,
"percent": 50
},
"heading": "Multiple Choice with Random Assignment v2"
}
],
"family": "single_choice",
"subtype": "vertical",
"answers": {
"choices": [
{
"text": "a",
"visible": True,
"position": 1
},
{
"text": "b",
"visible": True,
"position": 2
},
{
"text": "c",
"visible": True,
"position": 3
}
]
},
"position": 3
}
url = "https://api.surveymonkey.net/v3/surveys/%s/pages/%s/questions" % (survey_id, page_id)
r = s.post(url, data=payload)
print r.json()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment