GET | 3/surveys/{surveyid}/respondents |
In this example we will show you how you can retrieve all respondents from a survey. We only want to retrieve the respondents from yesterday. A possible use case of this request is a scenario in which you would like a daily update of the respondents from a survey. In our example we are requesting the respondents from yesterday.
curl "https://api-eu.agileresearch.medallia.com/3/surveys/{SurveyId}/respondents?filter=ResponseDate%20ge%20DateTime'2024-12-20'and%20ResponseDate%20lt%20DateTime'2024-12-21'" -H "X-Master-Key:{MasterKey}" -H "X-Key:{Key}" -k
System.Net.Http.HttpClient client = new System.Net.Http.HttpClient(); client.BaseAddress = new Uri("https://api-eu.agileresearch.medallia.com/"); client.DefaultRequestHeaders.Add("X-Master-Key", "{MasterKey}"); client.DefaultRequestHeaders.Add("X-Key", "{Key}"); client.DefaultRequestHeaders.Accept.Add(new System.Net.Http.Headers.MediaTypeWithQualityHeaderValue("application/json")); string filter = string.Format("ResponseDate%20ge%20DateTime'{0}'and%20ResponseDate%20lt%20DateTime'{1}'", DateTime.Now.AddDays(-1).ToString("yyyy-MM-dd"), DateTime.Now.ToString("yyyy-MM-dd")); System.Net.Http.HttpResponseMessage response = client.GetAsync(string.Format("3/surveys/{0}/respondents?filter={1}", "{SurveyId}", filter)).Result;
When filtering on a Datetime, the required syntax is
ColumnName LogicalOperator DateTime'YYYY-MM-DD'
as in this example: ResponseDate ge DateTime'2024-12-20'
Hint: to include the individual responses, use the expand=Responses
parameter.
Hint: if you also need the text of the questions and response options, get them in a separate API call using the {SurveyId}/questions API endpoint.
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 |