Question
Supported Formats
JSON, XML
GET api/v1/questions/:questionnaire_id/questions/:id
Question details
The following question fields are returned:
- id
-
unique identifier of a question
- section_id
-
identifier of section
- looping_section_id
-
identifier of closest looping section. When present, question is looping and looping_contexts need to be processed to retrieve answers.
- url
-
API URL path of question details
- title
-
title of the question (translated where available)
- language
-
current language (given as ISO code)
- path
-
array of sections in which this question is nested
- type
-
one of MultiAnswer, RangeAnswer or NumericAnswer
- questionnaire_date
-
date when questionnaire was created
- is_mandatory
-
boolean flag denoting whether this question is mandatory to fill in
- options
-
array of available options (applicable to MultiAnswer and RangeAnswer)
- answers
-
array of answer objects when question is not looping
- respondent
-
full name of respondent
- answer_text
-
answer provided
- looping_contexts
-
array of looping context objects when question is looping:
- looping_identifier
-
unique identifier of the looping context
- looping_path
-
array of loop item names that make up this looping context
- answers
-
array of answer objects (like for non-looping sections)
Supported Formats
JSON, XMLErrors
400 Bad Request401 Unauthorized
404 Not Found
422 Unprocessable Entity
500 Internal Server Error
Examples
{ "question":{ "id":384, "section_id":244, "looping_section_id":242, "url":"/api/v1/questionnaires/16/questions/384", "title":"Reasons for issuing of licences (art. 9, i. to v.)", "language":"EN", "path":["EXCEPTIONS CONCERNING PROTECTED FAUNA SPECIES (ART. 7 APPENDIX III)","Vertebrates","#[Class > Order]","#[Family]","#[Species]","Details"], "type":"MultiAnswer", "is_mandatory":true, "options":[ "i.: protection of flora /fauna", "ii.: prevention of serious damage to crops, livestock, forests, fisheries, water and other forms of property", "iii.: in the interests of public health and safety, air safety or other overriding public interests (which?)", "iv.: for research / education / repopulation / reintroduction / necessary breeding", "v.: judicious exploitation of certain wild plants in small numbers and under certain conditions" ], "answers":[], "looping_contexts":[ { "looping_context":{ "looping_identifier":"6867S6868S6872", "looping_path":[ "FISHES > CYPRINIFORMES", "Cyprinidae", "Alburnoides bipunctatus" ], "answers":[ { "answer":{ "respondent":"Kristina Klovaite", "answer_text":"iv.: for research / education / repopulation / reintroduction / necessary breeding" } } ] } }, { "looping_context":{ "looping_identifier":"7359S7360S7361", "looping_path":[ "MAMMALS > LAGOMORPHA", "Leporidae", "Lepus timidus" ], "answers":[ { "answer":{ "respondent":"Tatsiana Trafimovich", "answer_text":"v.: judicious exploitation of certain wild plants in small numbers and under certain conditions" } } ] } } ] } }
<question> <id>384</id> <section_id>244</section_id> <looping_section_id>242</looping_section_id> <url>/api/v1/questionnaires/16/questions/384</url> <title>Reasons for issuing of licences (art. 9, i. to v.)</title> <language>EN</language> <path>["EXCEPTIONS CONCERNING PROTECTED FAUNA SPECIES (ART. 7&nbsp;&nbsp; APPENDIX III)", "Vertebrates", "#[Class &gt; Order]", "#[Family]", "#[Species]", "Details"]</path> <type>MultiAnswer</type> <is_mandatory>true</is_mandatory> <options>["i.: protection of flora /fauna", "ii.: prevention of serious damage to crops, livestock, forests, fisheries, water and other forms of property", "iii.: in the interests of public health and safety, air safety or other overriding public interests (which?)", "iv.: for research / education / repopulation / reintroduction / necessary breeding", "v.: judicious exploitation of certain wild plants in small numbers and under certain conditions"]</options> <answers/> <looping_answers> <looping_context> <looping_identifier>6867S6868S6872</looping_identifier> <looping_path>["FISHES > CYPRINIFORMES", "Cyprinidae", "Alburnoides bipunctatus"]</looping_path> <answer> <respondent>A</respondent> <answer_text>iv.: for research / education / repopulation / reintroduction / necessary breeding</answer_text> </answer> </looping_context> <looping_context> <looping_identifier>7359S7360S7361</looping_identifier> <looping_path>["MAMMALS > LAGOMORPHA", "Leporidae", "Lepus timidus"]</looping_path> <answer> <respondent>B</respondent> <answer_text>v.: judicious exploitation of certain wild plants in small numbers and under certain conditions</answer_text> </answer> </looping_context> </looping_answers> </question>
Params
Param name | Description |
---|---|
id required |
Id of the question Value: Must be String |
language optional |
Where available display data in language given by ISO code (e.g. “EN”). Defaults to questionnaire's default language. Value: Must be String |
GET api/v1/questions/:questionnaire_id/questions
List of questions
The following question fields are returned: [id] unique identifier of a question [section_id] identifier of section [looping_section_id] identifier of closest looping section. When present, question is looping and looping_contexts need to be processed to retrieve answers. [url] API URL path of question details [title] title of the question (translated where available) [language] current language (given as ISO code) [path] array of sections in which this question is nested [type] one of MultiAnswer, RangeAnswer or NumericAnswer [questionnaire_date] date when questionnaire was created [is_mandatory] boolean flag denoting whether this question is mandatory to fill in [options] array of available options (applicable to MultiAnswer and RangeAnswer)
Where more than 100 questions are returned, the request is paginated, showing 100 objects (or less by passing in an optional 'per_page' parameter) at a time. To fetch the remaining objects, you will need to make a new request and pass the optional ‘page’ parameter as below:
http://ors-api-host/api/v1/questionnaires?page=2&per_page=25
Information about the remaining pages is provided in the Link header of the API response. For example, making the above request for page two, with a limit of 25 objects per page would return the following in the link header along with a total-count header:
Link: <http://ors-api-host/api/v1/questionnaires/16/questions?page=3&per_page=25>; rel="next", <http://ors-api-host/api/v1/questionnaires/16/questions?page=2570&per_page=25>; rel="last" Total-Count: 64230
If there are additional pages, the link header will contain the URL for the next page of results, followed by the URL for the last page of results. The Total-Count header shows the total number of objects returned for this call, regardless of pagination.
Supported Formats
JSON, XMLErrors
400 Bad Request401 Unauthorized
404 Not Found
422 Unprocessable Entity
500 Internal Server Error
Examples
{ "questions":[ { "question":{ "id":384, "section_id":244, "looping_section_id":242, "url":"/api/v1/questionnaires/16/questions/384", "title":"Reasons for issuing of licences (art. 9, i. to v.)", "language":"EN", "path":["EXCEPTIONS CONCERNING PROTECTED FAUNA SPECIES (ART. 7 APPENDIX III)","Vertebrates","#[Class > Order]","#[Family]","#[Species]","Details"], "type":"MultiAnswer", "is_mandatory":true, "options":[ "i.: protection of flora /fauna", "ii.: prevention of serious damage to crops, livestock, forests, fisheries, water and other forms of property", "iii.: in the interests of public health and safety, air safety or other overriding public interests (which?)", "iv.: for research / education / repopulation / reintroduction / necessary breeding", "v.: judicious exploitation of certain wild plants in small numbers and under certain conditions" ] } } ] }
<questions> <question> <id>384</id> <section_id>244</section_id> <looping_section_id>242</looping_section_id> <url>/api/v1/questionnaires/16/questions/384</url> <title>Reasons for issuing of licences (art. 9, i. to v.)</title> <language>EN</language> <path>["EXCEPTIONS CONCERNING PROTECTED FAUNA SPECIES (ART. 7&nbsp;&nbsp; APPENDIX III)", "Vertebrates", "#[Class &gt; Order]", "#[Family]", "#[Species]", "Details"]</path> <type>MultiAnswer</type> <is_mandatory>true</is_mandatory> <options>["i.: protection of flora /fauna", "ii.: prevention of serious damage to crops, livestock, forests, fisheries, water and other forms of property", "iii.: in the interests of public health and safety, air safety or other overriding public interests (which?)", "iv.: for research / education / repopulation / reintroduction / necessary breeding", "v.: judicious exploitation of certain wild plants in small numbers and under certain conditions"]</options> </question> </questions>
Params
Param name | Description |
---|---|
page optional |
Page number for paginated responses. Value: Must be String |
per_page optional |
How many objects returned per page for paginated responses (#{MAX_PER_PAGE} by default) Value: Must be String |
language optional |
Where available display data in language given by ISO code (e.g. “EN”). Defaults to questionnaire's default language. Value: Must be String |