import SGPClient from 'sgp';
const client = new SGPClient({
apiKey: 'My API Key',
});
const question = await client.questions.retrieve('question_id');
console.log(question.id);
{
"type": "categorical",
"title": "<string>",
"prompt": "<string>",
"choices": [
{
"label": "<string>",
"value": "<string>",
"audit_required": false
}
],
"ratingOptions": {
"minLabel": "<string>",
"maxLabel": "<string>",
"scaleSteps": 123
},
"numberOptions": {
"min": 123,
"max": 123
},
"freeTextOptions": {
"characterLimit": {
"min": 50,
"max": 1000
}
},
"multi": true,
"dropdown": true,
"required": true,
"conditions": [
{}
],
"default": "<any>",
"form_schema": {},
"id": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"account_id": "<string>",
"created_by_user_id": "<string>",
"created_by_identity_type": "user"
}
Gets the details of a question
This API can be used to get information about a single question by ID. To use this API, pass in the id
that was returned from your Create Question API call as a path parameter.
Review the response schema to see the fields that will be returned.
import SGPClient from 'sgp';
const client = new SGPClient({
apiKey: 'My API Key',
});
const question = await client.questions.retrieve('question_id');
console.log(question.id);
{
"type": "categorical",
"title": "<string>",
"prompt": "<string>",
"choices": [
{
"label": "<string>",
"value": "<string>",
"audit_required": false
}
],
"ratingOptions": {
"minLabel": "<string>",
"maxLabel": "<string>",
"scaleSteps": 123
},
"numberOptions": {
"min": 123,
"max": 123
},
"freeTextOptions": {
"characterLimit": {
"min": 50,
"max": 1000
}
},
"multi": true,
"dropdown": true,
"required": true,
"conditions": [
{}
],
"default": "<any>",
"form_schema": {},
"id": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"account_id": "<string>",
"created_by_user_id": "<string>",
"created_by_identity_type": "user"
}
Successful Response
The response is of type object
.