GET | 3/surveys/{SurveyId}/respondents |
GET | 3/surveys/{surveyid}/questions/{QuestionId}/result |
We will show you some examples of what you can do with our filters. Querying based on strings, datetime, responses and a combination of them.
A survey called "Demo survey" has been created in your account when setting it up. Please make sure the API keys you use in these requests have access to the demo survey, and have at least Results (Read) rights. The surveyId variable in these example should be replaced with the survey id of your Demo survey.
When filtering for responses we need both the QuestionId and ResponseId, which we can find with a call to /3/survey/{surveyId}/questions.
These urls might seem overwhelming, but once you see how they work you will be able to do amazing things with it.
This question asks for the gender of your respondents. Answer option 1 is Male. In the demo survey we are talking about QuestionId: 2 and ResponseId:1.
https://api-eu.agileresearch.medallia.com/3/surveys/{SurveyId}/respondents?filter=Responses/any(Response:Response/QuestionId%20eq%202%20and%20Response/ResponseId%20eq%201)
Let's split up this url to see how it's working:
Don't limit your API calls to a list of respondents and start calculating the result. We already did this work for you: immediately call for the results and aggregates of a question.
Get the NPS for Question 8: How likely would you recommend your trip? for all male respondents.
https://api-eu.agileresearch.medallia.com/3/surveys/{SurveyId}/questions/13/result?filter=Responses/any(Response:Response/QuestionId%20eq%202%20and%20Response/ResponseId%20eq%201)
Compared to the previous call, we replaced the location part of the url from /respondents to /questions/{QuestionId}/result
Get all respondents for who the best experience comment contains Swimming
https://api-eu.agileresearch.medallia.com/3/surveys/{SurveyId}/respondents?filter=Responses/any(Response:Response/QuestionId%20eq%2015%20and%20substringof(Response/Value,'swimming')%20eq%20true)
We have used the following methods in this example. You can find all details regarding each request in the API Reference.
GET | 3/surveys/{SurveyId}/respondents |
GET | 3/surveys/{surveyid}/questions/{QuestionId}/result |