Skip to main content
REST API: Custom Surveys
Ray avatar
Written by Ray
Updated over a month ago

Endpoints to retrieve custom survey information from within Vitally using the REST API.

The Custom Survey object

Attributes

Description

Editable?

id

Vitally's unique ID for the custom survey response

No

surveyId

Vitally's unique ID for the survey

No

organizationId

Vitally ID for the organization this Survey belongs to (if applicable)

No

userID

The ID for the User that has responded to the survey

No

title

The title for the question

No

body

The description given to the survey

createdAt

The date/time when the custom survey was created

No

updatedAt

The date/time when the custom survey was updated

No

respondedAt

When the response to the survey was captured

No

Replace {subdomain} in the endpoints below with your Vitally subdomain.

You can find your subdomain in the URL used to log into Vitally (i.e., https://yoursubdomain.vitally.io

The Survey Type Object

Attributes

Description

Editable?

array

This returns the array of options

No

string

This returns the string value

No

date

This object contains a date value

No

number

This object contains the number value

No

The Survey Questions Object

Attributes

Description

Editable?

id

The ID for the survey response to the question

No

questionId

The ID for the survey question

No

data.type

The type of survey question (e.g. a string, number, array etc)

No

data.value

The value that has been submitted for the survey question

No

Survey Responses GET

US Data Center (default):

https://{subdomain}.rest.vitally.io/resources/surveyResponses/{Survey ID}

EU Data Center:

https://{subdomain}.rest.vitally-eu.io/resources/surveyResponses/{Survey ID}

The survey ID can be obtained from within the URL bar when visiting the survey in the VitallyUI.

Example Request

GET 
https://{subdomain]rest.vitally.io/resources/surveyResponses/f129305b-f9b7-4bb9-8c22-9cd3762a7c8a

Example Response

{
"data": {
"id": "f129305b-f9b7-4bb9-8c22-9cd3762a7c8a",
"surveyId": "2a02a807-5465-403b-901b-680a8d1c056c",
"createdAt": "2024-04-25T18:22:34.477Z",
"updatedAt": "2024-04-25T18:22:34.477Z",
"respondedAt": "2024-04-25T18:22:34.477Z",
"userId": "5f8c4e56-d3c5-4b05-b52f-bae0bbb4b476",
"questionResponses": [
{
"id": "5127bdfb-a07b-458d-9d14-e7d56180955f",
"questionId": "c1dc5239-8c56-47a4-9a50-bfd57d965dbc",
"data": {
"type": "number",
"value": 2
}
}
]
}
}

Survey Questions GET

US Data Center (default):

https://{subdomain}.rest.vitally.io/resources/surveyQuestions/{Question ID}

EU Data Center:

https://{subdomain}rest.vitally-eu.io/resources/surveyQuestions/{Question ID}

The question IDs can be obtained from within the response when running the request to get the survey response.

Example Request

GET 
https://{subdomain]rest.vitally.io/resources/surveyQuestion/f129305b-f9b7-4bb9-8c22-9cd3762a7c8a

Example Response

{
"data": {
"id": "c1dc5239-8c56-47a4-9a50-bfd57d965dbc",
"surveyId": "2a02a807-5465-403b-901b-680a8d1c056c",
"title": "On a scale of 1-10, how likely are you to recommend us to a friend or colleague?",
"body": "",
"isRequired": false,
"createdAt": "2024-04-25T14:06:08.089Z",
"updatedAt": "2024-08-16T08:22:32.774Z",
"type": "numberScale",
"min": 1,
"max": 10
}
}

Did this answer your question?