2

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!

Community
  • 1
  • 1
Jon Gallup
  • 317
  • 3
  • 11

2 Answers2

2

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.

philshem
  • 24,761
  • 8
  • 61
  • 127
  • Definitely like the API console. Looking into David's response I did notice that I would have to go through 3 different methods to get there. Though I'm thinking since the application I'm using it for isn't going to have that many users using it in unison, I can get away with trying to get the most recent respondent_id. First by using get_survey_list, then get_respondent_ids, then get_responses (as you outlined above). – Jon Gallup Oct 31 '13 at 20:12
  • I'm glad you find the API Console useful. If you always have the same survey_id, then the process gets simpler (2 steps instead of 3). As a neat tip, you can create "collectors" which is a way of differentiating groups of responders (i.e. same survey but for London group, Paris group). – philshem Nov 01 '13 at 10:54
  • After working with this a bunch and actually writing it in a testing script I was able to get it to work via the process above. Unfortunately, I'm going to have to use something other than SurveyMonkey or build me own as while SurveyMonkey works well I need something that will actually grade the user and tell them which answers were right or wrong. Thanks to everyone who contributed! – Jon Gallup Nov 05 '13 at 16:25
1

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

David Nguyen
  • 8,368
  • 2
  • 33
  • 49