Get Survey Result
GET /api/surveys/:id/result
Retrieve the results of a voice survey campaign. The response includes survey metadata, call status distribution, and detailed results for each phone number including the keys pressed by recipients during the survey.
Path Parameters
Section titled “Path Parameters”| Parameter | Type | Required | Description |
|---|---|---|---|
| id | integer | Yes | The survey ID returned from survey creation. |
Request Example
Section titled “Request Example”curl -X GET https://api.awajdigital.com/api/surveys/456/result \ -H "Authorization: Bearer your_api_token_here" \ -H "Accept: application/json"// Browser JavaScript (Fetch API)const surveyId = 456;const response = await fetch(`https://api.awajdigital.com/api/surveys/${surveyId}/result`, { method: 'GET', headers: { 'Authorization': 'Bearer your_api_token_here', 'Accept': 'application/json' }});
const data = await response.json();console.log(data);// Node.js with axiosconst axios = require('axios');
async function getSurveyResult(surveyId) { try { const response = await axios.get( `https://api.awajdigital.com/api/surveys/${surveyId}/result`, { headers: { 'Authorization': 'Bearer your_api_token_here', 'Accept': 'application/json' } } );
console.log(response.data); } catch (error) { console.error('Error:', error.response?.data || error.message); }}
getSurveyResult(456);# Python with requestsimport requests
def get_survey_result(survey_id): url = f'https://api.awajdigital.com/api/surveys/{survey_id}/result' headers = { 'Authorization': 'Bearer your_api_token_here', 'Accept': 'application/json' }
try: response = requests.get(url, headers=headers) print(response.json()) except requests.exceptions.RequestException as e: print(f'Error: {e}')
get_survey_result(456)<?php// PHP with cURL$surveyId = 456;$url = "https://api.awajdigital.com/api/surveys/{$surveyId}/result";$token = 'your_api_token_here';
$ch = curl_init($url);curl_setopt($ch, CURLOPT_HTTPGET, true);curl_setopt($ch, CURLOPT_HTTPHEADER, [ 'Authorization: Bearer ' . $token, 'Accept: application/json']);curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);curl_close($ch);
$result = json_decode($response, true);print_r($result);?>In-Progress Survey Response
Section titled “In-Progress Survey Response”{ "success": true, "survey": { "id": 456, "name": "api_survey_1_customer_satisfaction_survey_3", "status": "broadcasting", "totalCount": 3, "completeCount": 1, "createdAt": "2025-12-30T10:00:00.000Z", "metadata": { "campaign_id": "summer2025", "customer_segment": "premium" } }, "isComplete": false, "statusDistribution": { "pending": 2, "answered": 1, "not_answered": 0, "failed": 0 }, "numbers": [ { "number": "019XXXXXXXX", "status": "pending", "duration": null, "pressedKeys": [] }, { "number": "018XXXXXXXX", "status": "answered", "duration": 45, "pressedKeys": ["1", "5"] }, { "number": "017XXXXXXXX", "status": "pending", "duration": null, "pressedKeys": [] } ]}Completed Survey Response
Section titled “Completed Survey Response”{ "success": true, "survey": { "id": 456, "name": "api_survey_1_customer_satisfaction_survey_3", "status": "completed", "totalCount": 3, "completeCount": 3, "createdAt": "2025-12-30T10:00:00.000Z", "metadata": { "campaign_id": "summer2025", "customer_segment": "premium" } }, "isComplete": true, "statusDistribution": { "pending": 0, "answered": 2, "not_answered": 1, "failed": 0 }, "numbers": [ { "number": "019XXXXXXXX", "status": "answered", "duration": 52, "pressedKeys": ["2", "4", "1"] }, { "number": "018XXXXXXXX", "status": "answered", "duration": 45, "pressedKeys": ["1", "5"] }, { "number": "017XXXXXXXX", "status": "not_answered", "duration": null, "pressedKeys": [] } ]}