Add Survey
Use this endpoint to create a survey.
Endpoint
- Method:
POST - URL:
https://api.surveyol.com/v1/survey
Parameters
title(string)
cURL Example
curl --request POST \
--url https://api.surveyol.com/v1/survey \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"title": "Customer Satisfaction Survey"
}'
Response Example
{
"id": "bf92a312-cc65-4126-8298-bcb5c957bddd",
"title": "Customer Satisfaction Survey"
}
Add Survey Page
Use this endpoint to add a page to an existing survey.
Endpoint
- Method:
POST - URL:
https://api.surveyol.com/v1/survey/{surveyId}/page
Parameters
surveyId(string)title(string)
cURL Example
curl --request POST \
--url https://api.surveyol.com/v1/survey/f04e6345-dd11-4342-8975-0a718d853505/page \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"title": "Your Workplace"
}'
Response Example
{
"id": "925c5b5a-3aae-4845-8eaf-595b14f85a43",
"title": "Your Workplace",
"pageIndex": 0
}
Add Survey Question
Use this endpoint to add a question to a survey page.
Endpoint
- Method:
POST - URL:
https://api.surveyol.com/v1/page/{pageId}/question
Parameters
pageId(string)type(string)properties(object)
Supported type values in examples are:
Star RatingMultiple ChoiceComment Box
requireAnswer in properties defaults to false when omitted.
cURL Example
curl --request POST \
--url https://api.surveyol.com/v1/page/925c5b5a-3aae-4845-8eaf-595b14f85a43/question \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"type": "Star Rating",
"properties": {
"title": "How would you rate us?",
"length": 5,
"color": "#F5A623",
"half": false
}
}'
Response Example
{
"id": "e1a760f9-dcf1-4c6d-b516-639c4b803a61",
"type": "Star Rating",
"questionIndex": 0,
"properties": {
"title": "How would you rate us?",
"length": 5,
"color": "#F5A623",
"half": false
}
}
Error Example: Invalid Question Type
Request:
curl --request POST \
--url https://api.surveyol.com/v1/page/925c5b5a-3aae-4845-8eaf-595b14f85a43/question \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"type": "Slider",
"properties": {
"title": "How would you rate us?"
}
}'
Response:
{
"error": "invalid_request"
}
Error Example: Invalid Properties
Request:
curl --request POST \
--url https://api.surveyol.com/v1/page/925c5b5a-3aae-4845-8eaf-595b14f85a43/question \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"type": "Star Rating",
"properties": {
"title": "How would you rate us?"
}
}'
Response:
{
"error": "invalid_request"
}