Reputation: 11
I want to get user's response along with question from surveyGizmo. I am getting list of questions and possible answers.
But I want specific answer which user has given during survey.
https://restapi.surveygizmo.com/v5/survey/123456/surveyresponse?api_token='some token'
Upvotes: 0
Views: 541
Reputation: 9
I can suggest solution, but only on python and missing some profit for you, becasue your task is not exact. It's a general way to print all answers. And you can choose that you need.
#needed packages
from surveygizmo import SurveyGizmo
import json
#auth
sg = SurveyGizmo(
api_version='v4',
response_type='json',
api_token = api_token,
api_token_secret = api_token_secret
)
#get data from your account as json (as I know json is optional)
answers = json.loads(sg.api.surveyresponse.list(surveyid, resultperpage=resultperpage, page=page)
#in answers['data'] are saved onlu responses
list_of_answers = answers['data']
#using loop you can get all answers on all questions
for answer_index in list_of_respondents:
for question_index, question_value in enumerate(list_of_answers[answer_index])
#SurveyGizmo data structure contains answers with labels like '[question(question_id), [option(option_id)' — that's why we need this 'if'
if question_value.startswith('[question'):
print(list_of_answers[answer_index][question_value])
Actually I'm working with it now and try to transfer all sg-data to sql like database and it makes me to do find simpliest ways to work. So f you give more information, I can make more profit for you.
Upvotes: 1