Getting respondent names and email addresses in SurveyMonkey's API v3

664 Views Asked by At

I'm upgrading my application from SurveyMonkey's API v2 to v3 and using the liogi/surveymonkey-api-v3 library to wrap around my API calls and am not sure if I'm understanding how respondent info is being handled now.

The v2 endpoint POST /surveys/get_respondent_list would return data.respondents[_].email, .first_name, and .last_name, but its v3 equivalent doesn't.

Is it the case that with the API v3, this data can only be pulled from pages[_].questions[_].answers[_].text?

I hope not, because that makes pulling respondent names and email addresses way more complicated and seemingly necessitates knowing the question IDs that correspond to the correct fields for every survey. Am I misinterpreting the API, or has that "get respondent's email address" feature been gutted?

1

There are 1 best solutions below

1
On BEST ANSWER

The email, first_name, and last_name are now all in the contact data in the metadata field provided in the response body when fetching a response.

So a request like:

GET /v3/surveys/<survey_id>/responses/<response_id>

will return something like this in the body:

{
    ...
    "metadata": {
       "contact": {
         "first_name": {
           "type": "string",
           "value": "Test"
         },
         "last_name": {
           "type": "string",
           "value": "Example"
         },
         "email": {
           "type": "string",
           "value": "[email protected]"
         }
       }
     }
    ...
}

Those 3 fields will also show up in the same place for the bulk responses endpoint.