Help Center/ Cognitive Engagement Center/ API Reference/ Survey Interface Reference/ Obtaining the Next Question (getNextQuestionInfo)
Updated on 2023-09-27 GMT+08:00

Obtaining the Next Question (getNextQuestionInfo)

Scenario

This interface is invoked to obtain the content of the next question in a survey.

Method

POST

URI

https://Domain name/apiaccess/v1/scriptAnswer/getNextQuestionInfo, for example, service.besclouds.com.

Request Description

Table 1 Request header parameters

No.

Parameter

Type

Mandatory or Not

Description

1

Authorization

String

Yes

Authentication field. The format is Bearer +AccessToken returned by the tokenByAKSK interface. (A space is required next to Bearer.)

2

x-app-key

String

Yes

App key field, which is the user ID. Contact the operation personnel to obtain the app key.

Table 2 Request body parameters

No.

Parameter

Type

Mandatory or Not

Description

1

surveyId

String

Yes

Survey ID.

2

questionId

String

No

Current question ID. For example, to obtain the second question, set this parameter to the first question ID.

To obtain the first question, do not transfer this parameter or transfer an empty string.

3

isAnswered

boolean

Yes

Whether the question is mandatory. The value is fixed to true.

4

questionType

String

No

Question type.

essay: short-answer question

single: single-answer question

multi: multiple-answer question

voice: voice

voiceOperation: voice+operation

5

answerOptionIdList

List<String>

No

List of answer option IDs, for example, ["optionId1"].

Response Description

  • Status code: 200
    Table 3 Response body parameters

    No.

    Parameter

    Type

    Mandatory or Not

    Description

    1

    resultCode

    String

    Yes

    Return code.

    2

    resultDesc

    String

    Yes

    Description of the message returned by the interface.

    3

    questionId

    String

    Yes

    Question ID.

    4

    answerNo

    Integer

    Yes

    Question No.

    5

    optionIdList

    Array[Object]

    Yes

    Question option. This parameter has a value when the question type is a multiple choice question.

    6

    questionType

    String

    Yes

    Question type.

    single: single-answer question

    multi: multiple-answer question

    essay: short-answer question

    voice: voice

    voiceOperation: voice+operation

    7

    content

    String

    Yes

    Question content.

  • Status code: 400

    Incorrect request. Check the request path and parameters.

  • Status code: 401

    Unauthorized operation. 1. Check whether you have purchased related services. 2. Contact customer service to check the status of your account.

  • Status code: 403

    Authentication fails.

  • Status code: 404

    The requested content is not found. Check the request path.

  • Status code: 500

    Business failure. Check the values of parameters in the request.

Error Codes

  • None

Example

Request header:

{
    "x-app-key": ********************
    "Authorization": Bearer ************************
}
Request parameters:
{
    "surveyId":"987654321",
    "questionId": "123456789",
    "isAnswered":true
}
Response parameters:
{
    "score": 70,
    "oprRule": {},
    "questionId": "123456789",
    "answerNo": 1,
    "resultCode": "1203000",
    "optionIdList": [],
    "resultDesc": "Opration Successful.",
    "questionType": "voice",
    "content": "Why cannot I recharge part of the call fee through WeChat?"
}