Surveys - Survey Questions API
- List all questions of a survey
- Get a single question of a survey
- Add a question to a survey
- Update a question of a survey
- Remove a question from a survey
- Remove all questions from a survey
- Fields
List all questions of a survey
List all questions of a survey with a specific ID.
GET /surveys/:id/survey_questions
Response
Status: 200 OK
[
{
"id": 2,
"survey": {
"id": 1,
"name": "My Survey",
"nodeID": "..."
},
"type": "text",
"question": "What could we do to improve?",
"position": 1,
"created_at": "2021-07-21T06:41:08-05:00",
"updated_at": "2021-07-21T06:41:08-05:00",
"...": "..."
},
"..."
]
The response contains these fields by default.
Collection Fields
By default the following fields will appear in collections of survey questions:
id
survey
type
question
created_at
updated_at
Obtain a different set of fields using the ?fields= parameter.
Get a single question of a survey
GET /surveys/:id/survey_questions/:question_id
Response
Status: 200 OK
{
"id": 2,
"survey": {
"id": 1,
"name": "My Survey",
"nodeID": "..."
},
"type": "text",
"question": "What could we do to improve?",
"position": 1,
"created_at": "2021-07-21T06:41:08-05:00",
"updated_at": "2021-07-21T06:41:08-05:00",
"...": "..."
}
The response contains these fields.
Add a question to a survey
Add a question to a survey with a specific ID.
POST /surveys/:id/survey_questions
When creating a new question for a survey these fields are available.
Response
Status: 200 OK
{
"question": "How did we do?",
"...": "..."
}
The response contains all fields of the created survey and is similar to the response in Get a single survey question.
Update a question of a survey
Update a question with a specific ID of a survey with a specific ID.
PATCH /surveys/:id/survey_questions/:question_id
When updating an existing question of a survey these fields are available.
Response
Status: 200 OK
{
"question": "How did we do?",
"...": "..."
}
The response contains all fields of the created survey and is similar to the response in Get a single survey question.
Remove a question from a survey
Remove question with a specific ID from a survey with a specific ID.
DELETE /surveys/:id/survey_questions/:question_id
Response
Status: 204 No Content
Remove all questions from a survey
Remove all questions from a survey with a specific ID.
DELETE /surveys/:id/survey_questions
Response
Status: 204 No Content
Fields
- attachments
- Readonly aggregated Attachments
- created_at
- Readonly datetime — The date and time at which the question was created.
- disabled
- Optional boolean, default:
false
— The Disabled box is checked when the question will not be shown to users completing the survey. - guidance
- Optional text (max 64KB) — The Guidance field is used for additional information to aid in answering the question.
- guidance_attachments
- Writeonly attachments The attachments used in the Guidance field.
- id
- Readonly integer — The unique ID of the question.
- position
- Optional integer — The Position field is used to specify the position of the question, relative to the other questions of the survey. The first question has position 1.
- question
- Required string (max 128) — The question to pose to the user.
- source
- Optional string (max 30) - See source
- sourceID
- Optional string (max 128) - See source
- type
- Required enum — The Type field is used to select the type of the question. Valid values are:
-
star_rating
: Star Ratingtext
: Free Text
- updated_at
- Readonly datetime — The date and time of the last update of the question.
If the question has no updates it contains the
created_at
value. - weight
- Optional integer — The Weight field is only used for rating question. It is used to specify the relative weight of the question compared to the others in the survey.