Get a question by id
GET/surveys/sessions/:token/questions/:questionId
Get question or answered question by question id and survey token
Request
Path Parameters
The token identifying this session
The question for which the answer corresponds to
Responses
- 200
- 401
- 403
- 405
- 500
Get question or answered question by question id and survey token
- application/json
- Schema
- Example (from schema)
Schema
Array [
Array [
]
]
Array [
Array [
]
]
Id of this question
Possible values: [transport
, lifestyle
, diet
, home
, publicservices
, intro
, personal
, summary
]
The id of this area, see Area
The question to be answered
The question posed to the user
Id of previous question in order to navigate back and change previous question
Holds the id of the next question to be answered can be fetched with the /surveys/sessions/:token/questions/:id
endpoint
If populated this section
If multiQuestion is true then the answers array will contain multiple questions and answers for the users to respond to Example:
Q: How many flights have you taken in these categories
A[0]: 0-4h
A[1]: 5-8h
A[2]: 8-12h
A[3]: More than 12h
answers
object[]
required
A set of Answers for this question. If present this denotes the valid answers for this Question Example: Q: Which country do you live in? Options: [Albania, Argentina, Aruba, etc...]
Title to display for the user
clarification
object
options
object[]
Options for the user to Answer if applicable
Id of the question
true if this option needs input from the user or not
Possible values: [input
, range
, boolean
, list
, button
, search
]
input, range, boolean
The option
clarification
object
Possible values: [km
, m
, liter
, m2
, m3
, mi.
, ft.
, gal.
, ft2
, kWh
, hours
, minutes
, days
, weeks
, months
, percent
, currency
]
km, m, litre, m3, m2, minutes, percent
True if the user chose this option as answer
Javascript based regular expression to validate user input
If @requiresInput is true then answer from user is stored here Otherwise its already populated
If the value should be entered as a range between rangeMin and rangeMax this will be populated with the minimum value for the range
If the value should be entered as a range between rangeMin and rangeMax this will be populated with the maximum value for the range
In a range scenario this denotes the step range should step up by
If this option supports autofill, a GET request can be made to this endpoint in order to get matching options
Indicates if there are more questions in the survey. If false then this is the las question in the survey
meta
object
required
Session and meta information used by the server. Should be sent with every request to server
Percentage of the questionnaire that is already answered
Sum of all emissions up until now
sectors
object[]
required
Distribution of emissions per sector
Possible values: [transport
, lifestyle
, diet
, home
, publicservices
, intro
, personal
, summary
]
sectorDetails
object[]
required
progress
object
Represents the current progress in a certain area:
example:
{
name: 'transport', // Area
count: 10, // Number of answered questions
total: 20, // Total number of question in area
progress: 0.5 // 50% answered
}
Name of the area
No of answered questions in area
Total number of questions in area
Progress percentage
Total number of questions
Index of current question
{
"id": "string",
"sectorId": "transport",
"title": "string",
"question": "string",
"previousQuestionId": "string",
"nextQuestionId": "string",
"nextSection": "string",
"multiQuestion": true,
"answers": [
{
"title": "string",
"clarification": {
"title": "string",
"body": "string"
},
"options": [
{
"id": "string",
"requiresInput": true,
"type": "input",
"option": "string",
"clarification": {
"title": "string",
"body": "string"
},
"unit": "km",
"isUserAnswer": true,
"validationExpression": "string",
"input": "string",
"rangeMin": 0,
"rangeMax": 0,
"rangeStep": 0,
"autoCompletePath": "string"
}
]
}
],
"hasNextQuestion": true,
"meta": {
"percentage": 0,
"totalEmissions": 0,
"sectors": [
{
"emissions": 0,
"id": "transport",
"name": "string",
"sectorDetails": [
{
"emissions": 0,
"id": "string",
"name": "string"
}
],
"progress": {
"name": "string",
"count": 0,
"total": 0,
"progress": 0
}
}
],
"numberOfQuestions": 0,
"currentQuestionIndex": 0
}
}
Unauthorized client
- application/json
- Schema
- Example (from schema)
Schema
Array [
]
errors
object[]
required
Detailed errors
The application name that generated this error
Possible values: [BAD_REQUEST
, FORBIDDEN
, INTERNAL_SERVER_ERROR
, METHOD_NOT_ALLOWED
, UNSUPPORTED_MEDIA_TYPE
]
A unique constant identifying the error case encountered during request processing
BAD_REQUEST
- Malformed request, please advice the description
and details fields for more information
FORBIDDEN
- Insufficient scope to access the resource
INTERNAL_SERVER_ERROR
- Unexpected server error
METHOD_NOT_ALLOWED
- Method not allowed
UNSUPPORTED_MEDIA_TYPE
- Unsupported media type
Short description of the reasonCode field.
Indicates whether this error will always be returned for this request, or retrying could change the outcome.
Where appropriate, indicates detailed information about data received and calculated during request processing, to help the user with diagnosing errors.
{
"errors": [
{
"source": "string",
"reasonCode": "BAD_REQUEST",
"description": "string",
"recoverable": true,
"details": "string"
}
]
}
Insufficient scope for accessing this resource
- application/json
- Schema
- Example (from schema)
Schema
Array [
]
errors
object[]
required
Detailed errors
The application name that generated this error
Possible values: [BAD_REQUEST
, FORBIDDEN
, INTERNAL_SERVER_ERROR
, METHOD_NOT_ALLOWED
, UNSUPPORTED_MEDIA_TYPE
]
A unique constant identifying the error case encountered during request processing
BAD_REQUEST
- Malformed request, please advice the description
and details fields for more information
FORBIDDEN
- Insufficient scope to access the resource
INTERNAL_SERVER_ERROR
- Unexpected server error
METHOD_NOT_ALLOWED
- Method not allowed
UNSUPPORTED_MEDIA_TYPE
- Unsupported media type
Short description of the reasonCode field.
Indicates whether this error will always be returned for this request, or retrying could change the outcome.
Where appropriate, indicates detailed information about data received and calculated during request processing, to help the user with diagnosing errors.
{
"errors": [
{
"source": "string",
"reasonCode": "BAD_REQUEST",
"description": "string",
"recoverable": true,
"details": "string"
}
]
}
Method not allowed
- application/json
- Schema
- Example (from schema)
Schema
Array [
]
errors
object[]
required
Detailed errors
The application name that generated this error
Possible values: [BAD_REQUEST
, FORBIDDEN
, INTERNAL_SERVER_ERROR
, METHOD_NOT_ALLOWED
, UNSUPPORTED_MEDIA_TYPE
]
A unique constant identifying the error case encountered during request processing
BAD_REQUEST
- Malformed request, please advice the description
and details fields for more information
FORBIDDEN
- Insufficient scope to access the resource
INTERNAL_SERVER_ERROR
- Unexpected server error
METHOD_NOT_ALLOWED
- Method not allowed
UNSUPPORTED_MEDIA_TYPE
- Unsupported media type
Short description of the reasonCode field.
Indicates whether this error will always be returned for this request, or retrying could change the outcome.
Where appropriate, indicates detailed information about data received and calculated during request processing, to help the user with diagnosing errors.
{
"errors": [
{
"source": "string",
"reasonCode": "BAD_REQUEST",
"description": "string",
"recoverable": true,
"details": "string"
}
]
}
Unexpected server error
- application/json
- Schema
- Example (from schema)
Schema
Array [
]
errors
object[]
required
Detailed errors
The application name that generated this error
Possible values: [BAD_REQUEST
, FORBIDDEN
, INTERNAL_SERVER_ERROR
, METHOD_NOT_ALLOWED
, UNSUPPORTED_MEDIA_TYPE
]
A unique constant identifying the error case encountered during request processing
BAD_REQUEST
- Malformed request, please advice the description
and details fields for more information
FORBIDDEN
- Insufficient scope to access the resource
INTERNAL_SERVER_ERROR
- Unexpected server error
METHOD_NOT_ALLOWED
- Method not allowed
UNSUPPORTED_MEDIA_TYPE
- Unsupported media type
Short description of the reasonCode field.
Indicates whether this error will always be returned for this request, or retrying could change the outcome.
Where appropriate, indicates detailed information about data received and calculated during request processing, to help the user with diagnosing errors.
{
"errors": [
{
"source": "string",
"reasonCode": "BAD_REQUEST",
"description": "string",
"recoverable": true,
"details": "string"
}
]
}