# Get summary of responses GET https://api.prolific.com/api/v1/surveys/{survey_id}/responses/summary/ Get an aggregated summary of responses for a given survey. Reference: https://beta-docs.prolific.com/api-reference/surveys/get-summary ## OpenAPI Specification ```yaml openapi: 3.1.1 info: title: Get summary of responses version: endpoint_surveys.GetSummary paths: /api/v1/surveys/{survey_id}/responses/summary/: get: operationId: get-summary summary: Get summary of responses description: Get an aggregated summary of responses for a given survey. tags: - - subpackage_surveys parameters: - name: survey_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/SurveySummary' '400': description: Error content: {} components: schemas: SurveySummaryAnswer: type: object properties: answer_id: type: string format: uuid description: The answer ID. answer: type: string description: The answer selected. count: type: integer default: 0 description: The count of how many times this answer was used in a response. required: - answer SurveySummaryQuestion: type: object properties: question_id: type: string format: uuid description: The question ID. question: type: string description: The title of the question. total_answers: type: integer default: 0 description: The total number of answered responses for a given question. answers: type: array items: $ref: '#/components/schemas/SurveySummaryAnswer' description: A list of aggregated answer information. required: - question SurveySummary: type: object properties: survey_id: type: string description: The survey ID. questions: type: array items: $ref: '#/components/schemas/SurveySummaryQuestion' description: A list of questions for the given survey. required: - survey_id ``` ## SDK Code Examples ```python import requests url = "https://api.prolific.com/api/v1/surveys/survey_id/responses/summary/" headers = {"Authorization": ""} response = requests.get(url, headers=headers) print(response.json()) ``` ```javascript const url = 'https://api.prolific.com/api/v1/surveys/survey_id/responses/summary/'; 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 package main import ( "fmt" "net/http" "io" ) func main() { url := "https://api.prolific.com/api/v1/surveys/survey_id/responses/summary/" 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 require 'uri' require 'net/http' url = URI("https://api.prolific.com/api/v1/surveys/survey_id/responses/summary/") 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 HttpResponse response = Unirest.get("https://api.prolific.com/api/v1/surveys/survey_id/responses/summary/") .header("Authorization", "") .asString(); ``` ```php request('GET', 'https://api.prolific.com/api/v1/surveys/survey_id/responses/summary/', [ 'headers' => [ 'Authorization' => '', ], ]); echo $response->getBody(); ``` ```csharp var client = new RestClient("https://api.prolific.com/api/v1/surveys/survey_id/responses/summary/"); var request = new RestRequest(Method.GET); request.AddHeader("Authorization", ""); IRestResponse response = client.Execute(request); ``` ```swift import Foundation let headers = ["Authorization": ""] let request = NSMutableURLRequest(url: NSURL(string: "https://api.prolific.com/api/v1/surveys/survey_id/responses/summary/")! 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() ```