How do you get the Respondent ID from a Survey Mon

2019-07-20 07:41发布

问题:

The Story

I'm in the beginning stages of creating a video teaching engine for a retailer incentive program my company is putting together. The way it will work is that retailers will register and be provided the ability to login to the system to access the content. Once logged in, retailers will watch short videos about my company's products and then they will be asked to answer a 3 or 4 question quiz about the product. The idea is that based on their responses they will earn the incentive. For example: the user passes 10 quizzes then they get a significant discount on their next order from my company.

The Problem

So I'm getting to the point where I'm researching different ways to go about putting together the whole program and am trying to determine the best way to write it. One thought so far is to create the quizzes as SurveyMonkey surveys and then process the results from that to award the incentive. I've been looking through the SurveyMonkey PHP API and I see that there is a method to get_responses(), which seems like it's exactly what I'm after. The problem is, is that this method takes a respondent_id for one of the parameters, which I have no idea how you get.

The Question

How do I get the respondent_id after the user has taken the quiz/survey? Ideally I would like to get this, then get the response information, process it, and then output a result/increment the number of incentives earned. I did do some looking around here on StackOverflow and found this: Get details about survey monkey's questions and answers by id, but it doesn't really look like what I'm after.

If this isn't something that SurveyMonkey can really do, that's OK, as I'm more just looking for an efficient way of doing it, short of having to build the whole thing myself. As always any help or info is appreciated!

回答1:

In order to get the responses, you need a list of respondent_ids. And in order to get the respondent_ids, you need to have the survey_id(s) from the get_survey_list API call. Note that the responses only includes a question_id that maps to the question (text and possible answers) in the output of get_survey_details (with the exception of open-ended text answers).

If this isn't something that SurveyMonkey can really do, that's OK, as I'm more just looking for an efficient way of doing it, short of having to build the whole thing myself.

It takes a modest code infrastructure to get all these pieces put together. You may want to start with the API Console and see if the output of the API can be of use to you.



回答2:

https://developer.surveymonkey.com/mashery/get_respondent_list seems to be what you are looking for, from there you can get the response information.