List of operations for the resource


Name

URL

Description

List of questions

/questions/:id_survey/:id_page

Returns a list of questions for the survey with the specified ID.



 

Description of response parameters

Name/path

Description

Possible values

id

Question ID

id_page

ID of the page where the question is located

number

Question number

type

Question type

0 – Single choice
1 – Matrix single choice
2 – Open-ended
3 – Point allocation
4 – Form
5 – Ranking
6 – Multiple choice
7 – Matrix multiple choice
8 – Slider
9 – Descriptive block
10 – Number
11 – E-mail
12 – Date
13 – Drop-down list
14 – GIODO clause
15 – File upload
16 – NPS
17 – Matrix open-ended
19 – Drag and drop
20 – Rating

date_created

Question creation date

date_modified

Date the question was last modified

text

Question text

desc

Question description

required

Flag indicating whether the question is mandatory

true – mandatory question
false – optional question

answers_count

number of answers in the question

internalName

internal (system) question name

options.long_answer

Flag indicating whether there should be space for a long text answer in the open-ended question. Parameter visible only for the open-ended question

true – long text answer
false – short text answer

options.min

In multiple choice questions: minimum number of selected answers
In date questions: the oldest date available to choose during completion
In number questions: the minimum possible value during completion. If the value is undefined, it will return null

0 – number in the given format
dd-mm-yyyy – date in the given format
null – if the value is undefined

options.max

In multiple choice questions: maximum number of selected answers
In date questions: the latest date available to choose during completion
In number questions: the maximum possible value during completion. If the value is undefined, it will return null

0 – number in the given format
dd-mm-yyyy – date in the given format
null – if the value is undefined

options.shuffle_answers

Flag indicating whether the display order of answers (cafeteria) should be randomized

Randomizing the order should be handled on the client application side. Regardless of this flag, the API will always return these answers in the same order.

Information available for questions: single choice, multiple choice, matrix single choice, matrix multiple choice, ranking, form, slider, drop-down list, drag and drop

true – random order of displaying answers
false – fixed order of displaying answers

options.horizintal_display

Flag indicating whether answers should be displayed next to each other (Horizontal orientation of displaying answers)

Information available for questions: single choice and multiple choice.

true – horizontal orientation of displaying answers
false – vertical orientation of displaying answers

options.range_positions_number

Number of slider positions. Option available only in the slider question.

answers.*

Answers in the question (cafeteria). Field present in questions: single choice, multiple choice, matrix single choice, matrix multiple choice, ranking, form, drop-down list, drag and drop, rating

Array

answers.text

Answer text

answers.custom_response_available

Flag indicating whether it is possible to provide a custom answer for a given option

true – custom answer available
false – custom answer unavailable

answers.required

Flag indicating whether filling in the answer field is mandatory. Parameter available only for the form type question

true – filling in the form field is mandatory
false – filling in the form field is not mandatory

scales.*

Subsequent scale positions (fixed) available for questions: matrix single choice, matrix multiple choice, matrix open-ended, drag and drop, rating

Array

scales.text

Scale label text

ranges.*

Extreme labels of the continuous scale, available only for the slider question

Array

ranges.left

Text on the left side of the scale

ranges.right

Text on the right side of the scale


List of questions

URL

(GET) https://app.customerhero.com/api/v2/questions/:id_survey/:id_page


Parameters (GET)

Name

Description

id_survey

ID of the survey containing the questions. Mandatory parameter

id_page

ID of the page containing the questions. The page must belong to the survey (id_survey). Optional parameter




Example response

[
  {
    "id":782299,
    "id_page":258355,
    "number":1,
    "type":0,
    "date_created":"2011-07-14 22:24:46",
    "date_modified":"2011-12-29 18:04:24",
    "text":"Single choice",
    "desc":"",
    "required":1,
    "answers_count":3,
    "internalName": ""
    "options":{
      "shuffle_answers":false,
      "horizontal_display":false
    },
    "answers":[
      {
        "text":"yes",
        "custom_response_available":false
      },
      {
        "text":"no",
        "custom_response_available":false
      },
      {
        "text":"other",
        "custom_response_available":true
      }
    ]
  },
  {
    "id":782300,
    "id_page":258355,
    "number":2,
    "type":6,
    "date_created":"2011-07-14 22:24:58",
    "date_modified":"2011-12-29 18:04:13",
    "text":"Multiple choice",
    "desc":"",
    "required":1,
    "answers_count":4,
    "internalName": ""
    "options":{
      "min":2,
      "max":2,
      "shuffle_answers":false,
      "horizontal_display":false
    },
    "answers":[
      {
        "text":"yes",
        "custom_response_available":false
      },
      {
        "text":"no",
        "custom_response_available":false
      },
      {
        "text":"maybe",
        "custom_response_available":false
      },
      {
        "text":"other",
        "custom_response_available":true
      }
    ]
  },
  {
    "id":782301,
    "id_page":258355,
    "number":3,
    "type":1,
    "date_created":"2011-07-14 22:25:10",
    "date_modified":"2011-12-29 18:04:04",
    "text":"matrix single choice",
    "desc":"",
    "required":1,
    "answers_count":2,
    "internalName": ""
    "options":{
      "shuffle_answers":false
    },
    "answers":[
      {
        "text":"ola"
      },
      {
        "text":"jola"
      }
    ],
    "scales":[
      {
        "text":"yes"
      },
      {
        "text":"no"
      }
    ]
  },{
    "id":782302,
    "id_page":258355,
    "number":4,
    "type":7,
    "date_created":"2011-07-14 22:25:27",
    "date_modified":"2011-12-29 18:03:54",
    "text":"matrix multiple choice",
    "desc":"Enter your eye color",
    "required":1,
    "answers_count":4,
    "internalName": ""
    "options":{
      "shuffle_answers":false
    },
    "answers":[
      {
        "text":"ola"
      },
      {
        "text":"jola"
      },
      {
        "text":"ala"
      },
      {
        "text":"zuza"
      }
    ],
    "scales":[
      {
        "text":"blue"
      },
      {
        "text":"green"
      },
      {
        "text":"hazel"
      }
    ]
  },
  {
    "id":782303,
    "id_page":258355,
    "number":5,
    "type":2,
    "date_created":"2011-07-14 22:25:36",
    "date_modified":null,
    "text":"open-ended",
    "desc":"",
    "required":1,
    "answers_count":1,
    "internalName": ""
    "options":{
      "long_answer":false
    }
  },
  {
    "id":782304,
    "id_page":258355,
    "number":6,
    "type":5,
    "date_created":"2011-07-14 22:25:52",
    "date_modified":null,
    "text":"Ranking question",
    "desc":"",
    "required":1,
    "answers_count":3,
    "internalName": ""
    "options":{
      "shuffle_answers":true
    },
    "answers":[
      {
        "text":"one"
      },
      {
        "text":"two"
      },
      {
        "text":"three"
      }
    ]
  },
  {
    "id":782305,
    "id_page":258355,
    "number":7,
    "type":4,
    "date_created":"2011-07-14 22:26:04",
    "date_modified":"2011-12-29 18:04:59",
    "text":"Form",
    "desc":"",
    "required":0,
    "answers_count":4,
    "internalName": ""
    "options":{
      "shuffle_answers":false
    },
    "answers":[
      {
        "text":"First name",
        "required":false
      },
      {
        "text":"Last name",
        "required":false
      },
      {
        "text":"PESEL",
        "required":true
      },
      {
        "text":"Phone",
        "required":true
      }
    ]
  },
  {
    "id":782306,
    "id_page":258355,
    "number":8,
    "type":8,
    "date_created":"2011-07-14 22:26:27",
    "date_modified":null,
    "text":"Differential",
    "desc":"",
    "required":1,
    "answers_count":2,
    "internalName": ""
    "options":{
      "shuffle_answers":false,
      "range_positions_number":6
    },
    "ranges":[
      {
        "left":"bad",
        "right":"good"
      },
      {
        "left":"sad",
        "right":"happy"
      }
    ]
  },
  {
    "id":819543,
    "id_page":258355,
    "number":9,
    "type":13,
    "date_created":"2011-12-29 16:56:00",
    "date_modified":null,
    "text":"Drop-down list",
    "desc":"",
    "required":1,
    "answers_count":4,
    "internalName": ""
    "options":{
      "shuffle_answers":true
    },
    "answers":[
      {
        "text":"one"
      },
      {
        "text":"two"
      },
      {
        "text":"three"
      },
      {
        "text":"four"
      }
    ]
  },
  {
    "id":819544,
    "id_page":258355,
    "number":10,
    "type":10,
    "date_created":"2011-12-29 16:57:27",
    "date_modified":"2011-12-29 18:03:18",
    "text":"Number question",
    "desc":"Additional description for the number question",
    "required":1,
    "answers_count":1,
    "internalName": ""
    "options":{
      "min":null,
      "max":10
    }
  },
  {
    "id":819545,
    "id_page":258355,
    "number":11,
    "type":11,
    "date_created":"2011-12-29 16:57:48",
    "date_modified":null,
    "text":"E-mail question",
    "desc":"",
    "required":1,
    "answers_count":1,
    "internalName": ""
  },
  {
    "id":819546,
    "id_page":258355,
    "number":12,
    "type":12,
    "date_created":"2011-12-29 16:58:07",
    "date_modified":null,
    "text":"Date question",
    "desc":"",
    "required":1,
    "answers_count":1,
    "internalName": ""
    "options":{
      "min":"01-12-2011",
      "max":"29-02-2012"
    }
  },
  {
    "id":1955652,
    "id_page":258355,
    "number":13,
    "type":16,
    "date_created":"2014-10-04 15:32:36",
    "date_modified":"2014-10-17 16:36:39",
    "text":"How likely are you to recommend our services to your friends?",
    "desc":"",
    "required":1,
    "answers_count":11,
    "internalName": ""
    "options":{
      "left_scale":"Definitely will not recommend",
      "right_scale":"Definitely will recommend",
      "justification":"Justify your answer"
    },
    "answers":[
      {
        "text":"0",
        "custom_response_available":true
      },
      {
        "text":"1",
        "custom_response_available":true
      },
      {
        "text":"2",
        "custom_response_available":true
      },
      {
        "text":"3",
        "custom_response_available":true
      },
      {
        "text":"4",
        "custom_response_available":true
      },
      {
        "text":"5",
        "custom_response_available":true
      },
      {
        "text":"6",
        "custom_response_available":true
      },
      {
        "text":"7",
        "custom_response_available":true
      },
      {
        "text":"8",
        "custom_response_available":true
      },
      {
        "text":"9",
        "custom_response_available":true
      },
      {
        "text":"10",
        "custom_response_available":true
      }
    ]
  },
  {
    "id":1955653,
    "id_page":258355,
    "number":14,
    "type":19,
    "date_created":"2011-07-14 22:25:10",
    "date_modified":"2011-12-29 18:04:04",
    "text":"drag and drop",
    "desc":"",
    "required":1,
    "answers_count":2,
    "internalName": ""
    "options":{
      "shuffle_answers":false
    },
    "answers":[
      {
        "text":"sea bath"
      },
      {
        "text":"skiing in the mountains"
      }
    ],
    "scales":[
      {
        "text":"summer"
      },
      {
        "text":"winter"
      }
    ]
  },
]

Returned errors

  • 400 Bad request – Incompatible parameters, the survey with ID :id_survey does not have a page with ID:id_page.

  • 401 Unauthorized – The user references a foreign resource – a survey that they do not own.

  • 404 Not Found – The survey with the given :id_survey was not found.

  • 406 Not Acceptable – The :id_survey parameter was not passed.