Get Survey Results
curl --request GET \
--url https://api.politicalcomms.com/v1/projects/{id}/survey-results \
--header 'X-API-Key: <api-key>'import requests
url = "https://api.politicalcomms.com/v1/projects/{id}/survey-results"
headers = {"X-API-Key": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'X-API-Key': '<api-key>'}};
fetch('https://api.politicalcomms.com/v1/projects/{id}/survey-results', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.politicalcomms.com/v1/projects/{id}/survey-results",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"X-API-Key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.politicalcomms.com/v1/projects/{id}/survey-results"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("X-API-Key", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.politicalcomms.com/v1/projects/{id}/survey-results")
.header("X-API-Key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.politicalcomms.com/v1/projects/{id}/survey-results")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["X-API-Key"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"success": true,
"data": {
"project_id": "01HX000000000000000000P002",
"name": "Primary Intent Survey",
"status": "completed",
"total_recipients": 5000,
"completion_rate": 42.1,
"dropoff_rate": 57.9,
"results": [
{
"question_id": "01HX000000000000000000Q002",
"sequence": 2,
"question_text": "Do you plan to vote in the primary? Reply 1 for Yes, 2 for No, 3 for Undecided.",
"question_type": "multiple_choice",
"total_responses": 812,
"option_results": [
{
"value": 1,
"label": "Yes",
"count": 500,
"percentage": 62
},
{
"value": 2,
"label": "No",
"count": 150,
"percentage": 18
},
{
"value": 3,
"label": "Undecided",
"count": 100,
"percentage": 12
}
],
"other_count": 62,
"other_percentage": 8
},
{
"question_id": "01HX000000000000000000Q003",
"sequence": 3,
"question_text": "What issue matters most to you this year?",
"question_type": "open_ended",
"total_responses": 145,
"option_results": [],
"other_count": 145,
"other_percentage": 100
}
]
}
}Projects
Get Survey Results
Topline results for a survey project: per-question option counts and percentages, the unmatched/open-ended “other” bucket, and overall completion/dropoff rates. The numbers match the survey results page in the dashboard.
Returns 409 (NOT_A_SURVEY) when the project is not a survey.
GET
/
projects
/
{id}
/
survey-results
Get Survey Results
curl --request GET \
--url https://api.politicalcomms.com/v1/projects/{id}/survey-results \
--header 'X-API-Key: <api-key>'import requests
url = "https://api.politicalcomms.com/v1/projects/{id}/survey-results"
headers = {"X-API-Key": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'X-API-Key': '<api-key>'}};
fetch('https://api.politicalcomms.com/v1/projects/{id}/survey-results', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.politicalcomms.com/v1/projects/{id}/survey-results",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"X-API-Key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.politicalcomms.com/v1/projects/{id}/survey-results"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("X-API-Key", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.politicalcomms.com/v1/projects/{id}/survey-results")
.header("X-API-Key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.politicalcomms.com/v1/projects/{id}/survey-results")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["X-API-Key"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"success": true,
"data": {
"project_id": "01HX000000000000000000P002",
"name": "Primary Intent Survey",
"status": "completed",
"total_recipients": 5000,
"completion_rate": 42.1,
"dropoff_rate": 57.9,
"results": [
{
"question_id": "01HX000000000000000000Q002",
"sequence": 2,
"question_text": "Do you plan to vote in the primary? Reply 1 for Yes, 2 for No, 3 for Undecided.",
"question_type": "multiple_choice",
"total_responses": 812,
"option_results": [
{
"value": 1,
"label": "Yes",
"count": 500,
"percentage": 62
},
{
"value": 2,
"label": "No",
"count": 150,
"percentage": 18
},
{
"value": 3,
"label": "Undecided",
"count": 100,
"percentage": 12
}
],
"other_count": 62,
"other_percentage": 8
},
{
"question_id": "01HX000000000000000000Q003",
"sequence": 3,
"question_text": "What issue matters most to you this year?",
"question_type": "open_ended",
"total_responses": 145,
"option_results": [],
"other_count": 145,
"other_percentage": 100
}
]
}
}Authorizations
Authenticate every request by passing your API key in the X-API-Key header. Keys are scoped to your organization hierarchy.
Path Parameters
Resource ID
⌘I
