我想获得用户的回复以及来自surveyGizmo 的问题。我正在获取问题列表和可能的答案。
但我想要用户在调查期间给出的具体答案。
https://restapi.surveygizmo.com/v5/survey/123456/surveyresponse?api_token='some token'
我想获得用户的回复以及来自surveyGizmo 的问题。我正在获取问题列表和可能的答案。
但我想要用户在调查期间给出的具体答案。
https://restapi.surveygizmo.com/v5/survey/123456/surveyresponse?api_token='some token'
我可以建议解决方案,但仅限于 python 并为您丢失一些利润,因为您的任务不准确。这是打印所有答案的通用方法。你可以选择你需要的。
#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])
实际上我现在正在使用它并尝试将所有 sg-data 传输到类似数据库的 sql 中,这让我找到了最简单的工作方式。因此,如果您提供更多信息,我可以为您赚取更多利润。