# Get response GET https://api.prolific.com/api/v1/surveys/{survey_id}/responses/{response_id} Get a single response for a survey. Reference: https://beta-docs.prolific.com/api-reference/surveys/get-response ## OpenAPI Specification ```yaml openapi: 3.1.1 info: title: Get response version: endpoint_surveys.GetResponse paths: /api/v1/surveys/{survey_id}/responses/{response_id}: get: operationId: get-response summary: Get response description: Get a single response for a survey. tags: - - subpackage_surveys parameters: - name: survey_id in: path required: true schema: type: string - name: response_id in: path required: true schema: type: string - name: Authorization in: header description: Header authentication of the form `undefined ` required: true schema: type: string responses: '200': description: Successful Response content: application/json: schema: $ref: '#/components/schemas/SurveyResponseOut' '400': description: Error content: {} components: schemas: SurveyResponseAnswer: type: object properties: answer_id: type: string format: uuid description: The answer ID. value: type: string description: The answer option value selected. required: - answer_id - value SurveyQuestionResponse: type: object properties: answers: type: array items: $ref: '#/components/schemas/SurveyResponseAnswer' description: The answers selected. question_id: type: string format: uuid description: The question ID. question_title: type: string description: The title of the survey question. required: - answers - question_id - question_title SurveyResponseSection: type: object properties: questions: type: array items: $ref: '#/components/schemas/SurveyQuestionResponse' description: The questions for a given section. section_id: type: string format: uuid description: The section ID. required: - questions - section_id SurveyResponseOut: type: object properties: _id: type: string date_created: type: string format: date-time description: The date/time the response was created (UTC). date_modified: type: string format: date-time description: The date/time the response was modified (UTC). participant_id: type: string description: The Prolific participant ID. sections: type: array items: $ref: '#/components/schemas/SurveyResponseSection' description: An array of sections from the survey, otherwise `questions`. questions: type: array items: $ref: '#/components/schemas/SurveyQuestionResponse' description: An array of questions from the survey, otherwise `sections`. submission_id: type: string description: The Prolific submission ID. required: - participant_id - submission_id ``` ## SDK Code Examples ```python simple import requests url = "https://api.prolific.com/api/v1/surveys/survey_id/responses/response_id" headers = {"Authorization": ""} response = requests.get(url, headers=headers) print(response.json()) ``` ```javascript simple const url = 'https://api.prolific.com/api/v1/surveys/survey_id/responses/response_id'; const options = {method: 'GET', headers: {Authorization: ''}}; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` ```go simple package main import ( "fmt" "net/http" "io" ) func main() { url := "https://api.prolific.com/api/v1/surveys/survey_id/responses/response_id" req, _ := http.NewRequest("GET", url, nil) req.Header.Add("Authorization", "") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` ```ruby simple require 'uri' require 'net/http' url = URI("https://api.prolific.com/api/v1/surveys/survey_id/responses/response_id") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Get.new(url) request["Authorization"] = '' response = http.request(request) puts response.read_body ``` ```java simple HttpResponse response = Unirest.get("https://api.prolific.com/api/v1/surveys/survey_id/responses/response_id") .header("Authorization", "") .asString(); ``` ```php simple request('GET', 'https://api.prolific.com/api/v1/surveys/survey_id/responses/response_id', [ 'headers' => [ 'Authorization' => '', ], ]); echo $response->getBody(); ``` ```csharp simple var client = new RestClient("https://api.prolific.com/api/v1/surveys/survey_id/responses/response_id"); var request = new RestRequest(Method.GET); request.AddHeader("Authorization", ""); IRestResponse response = client.Execute(request); ``` ```swift simple import Foundation let headers = ["Authorization": ""] let request = NSMutableURLRequest(url: NSURL(string: "https://api.prolific.com/api/v1/surveys/survey_id/responses/response_id")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "GET" request.allHTTPHeaderFields = headers let session = URLSession.shared let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in if (error != nil) { print(error as Any) } else { let httpResponse = response as? HTTPURLResponse print(httpResponse) } }) dataTask.resume() ``` ```python multi_question import requests url = "https://api.prolific.com/api/v1/surveys/survey_id/responses/response_id" headers = {"Authorization": ""} response = requests.get(url, headers=headers) print(response.json()) ``` ```javascript multi_question const url = 'https://api.prolific.com/api/v1/surveys/survey_id/responses/response_id'; const options = {method: 'GET', headers: {Authorization: ''}}; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` ```go multi_question package main import ( "fmt" "net/http" "io" ) func main() { url := "https://api.prolific.com/api/v1/surveys/survey_id/responses/response_id" req, _ := http.NewRequest("GET", url, nil) req.Header.Add("Authorization", "") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` ```ruby multi_question require 'uri' require 'net/http' url = URI("https://api.prolific.com/api/v1/surveys/survey_id/responses/response_id") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Get.new(url) request["Authorization"] = '' response = http.request(request) puts response.read_body ``` ```java multi_question HttpResponse response = Unirest.get("https://api.prolific.com/api/v1/surveys/survey_id/responses/response_id") .header("Authorization", "") .asString(); ``` ```php multi_question request('GET', 'https://api.prolific.com/api/v1/surveys/survey_id/responses/response_id', [ 'headers' => [ 'Authorization' => '', ], ]); echo $response->getBody(); ``` ```csharp multi_question var client = new RestClient("https://api.prolific.com/api/v1/surveys/survey_id/responses/response_id"); var request = new RestRequest(Method.GET); request.AddHeader("Authorization", ""); IRestResponse response = client.Execute(request); ``` ```swift multi_question import Foundation let headers = ["Authorization": ""] let request = NSMutableURLRequest(url: NSURL(string: "https://api.prolific.com/api/v1/surveys/survey_id/responses/response_id")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "GET" request.allHTTPHeaderFields = headers let session = URLSession.shared let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in if (error != nil) { print(error as Any) } else { let httpResponse = response as? HTTPURLResponse print(httpResponse) } }) dataTask.resume() ```