import SGPClient from 'sgp';
const client = new SGPClient({
apiKey: 'My API Key',
});
const question = await client.questions.create({
account_id: 'account_id',
prompt: 'prompt',
title: 'title',
type: 'categorical',
});
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"
}
Creates a question
This API can be used to create a question. To use this API, review the request schema and pass in all fields that are required to create a question.
import SGPClient from 'sgp';
const client = new SGPClient({
apiKey: 'My API Key',
});
const question = await client.questions.create({
account_id: 'account_id',
prompt: 'prompt',
title: 'title',
type: 'categorical',
});
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
.