Created
November 16, 2016 19:14
-
-
Save santina/672f5b57f708af0763adb4b5ead45af2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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