Updated on 2025-11-07 GMT+08:00

Responding to Questions Based on Q&A Pairs

Function

Process a one-time Q&A based on Q&A pairs.

URI

POST /v2/irobot/qapairs/ask

Request Parameters

Table 1 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

Specifies the user token.

It can be obtained by calling the IAM API (value of X-Subject-Token in the response header).

Minimum length: 1

Maximum length: 5000

x-service-key

Yes

String

Specifies the flag for invoking the intelligent customer service.

Minimum length: 1

Maximum length: 32

x-site

No

String

Specifies the site flag. The options are 0 (Chinese mainland) and 1 (international).

Minimum length: 0

Maximum length: 1

x-language

No

String

Specifies the region language with a language abbreviation. The options are en-us and zh-cn.

Minimum length: 0

Maximum length: 32

Table 2 Request body parameters

Parameter

Mandatory

Type

Description

question

Yes

String

Specifies the question entered by a user.

Minimum length: 1

Maximum length: 1000

domains

No

Array of strings

Specifies the theme list.

Minimum length: 1

Maximum length: 200

Array length: 0 - 200

top

No

Integer

Requests for the number of data records with the highest matching degree.

Minimum value: 1

Maximum value: 10

session_id

Yes

String

Specifies the session ID.

Minimum length: 1

Maximum length: 64

source_qa_pair_id

No

String

Specifies the Q&A pair ID.

Minimum length: 0

Maximum length: 64

operate_type

No

Integer

Specifies the operation type. The options are 0 (manual input), 1 (clicking a hot question), 2 (clicking a question that the user may want to ask), 3 (clicking a recommended question), and 4 (clicking a question prompt).

Options:

  • 0

  • 1

  • 2

  • 3

  • 4

threshold_enable

No

String

Specifies whether to enable the internal threshold.

product_type_id

No

String

Specifies the product type ID.

Minimum length: 0

Maximum length: 64

Response Parameters

Status code: 200

Table 3 Response body parameters

Parameter

Type

Description

question

String

Specifies the question.

Minimum length: 0

Maximum length: 65535

answers

Array of AnswerQaPair objects

Specifies the answer list.

Array length: 0 - 65535

error_code

String

Specifies the error code.

Minimum length: 0

Maximum length: 32

error_msg

String

Describes the error.

Minimum length: 0

Maximum length: 32

request_id

String

Specifies the request ID.

Minimum length: 0

Maximum length: 64

Table 4 AnswerQaPair

Parameter

Type

Description

score

Double

Specifies the similarity score.

Minimum value: 0

Maximum value: 1

answer

String

Specifies the answer.

Minimum length: 0

Maximum length: 9223372036854775807

domain

String

Specifies the domain.

Minimum length: 0

Maximum length: 65535

link

String

Specifies the link.

Minimum length: 0

Maximum length: 65535

question

String

Specifies the question.

Minimum length: 0

Maximum length: 65535

qa_pair_id

String

Specifies the Q&A pair ID.

Minimum length: 0

Maximum length: 65535

relevance_details

Array of RelevanceQapair objects

Specifies the list of related question details.

Array length: 0 - 65535

task_complete

Boolean

Specifies whether skill-based intent recognition is completed.

Table 5 RelevanceQapair

Parameter

Type

Description

link

String

Specifies the link.

Minimum length: 0

Maximum length: 65535

question

String

Specifies the standard question.

Minimum length: 0

Maximum length: 9223372036854775807

qa_pair_id

String

Specifies the standard question ID.

Minimum length: 0

Maximum length: 64

Request Example

POST https://{endpoint}/v2/irobot/qapairs/ask

{
  "question" : "How can I purchase ECS?",
  "session_id" : "session-id",
  "source_qa_pair_id" : "pair-id",
  "operate_type" : 1,
  "top" : 5
}

Response Example

Status code: 200

Code 200 is returned if the operation is successful.

{
  "request_id" : "request-id",
  "question" : "How can I purchase ECS?",
  "answers" : [ {
    "score" : 0.85,
    "answer" : "ECS purchase method",
    "domain" : "ECS",
    "link" : "link",
    "qa_pair_id" : "pair-001",
    "task_complete" : true,
    "relevance_details" : null
  } ]
}

Status Codes

Status Code

Description

200

Code 200 is returned if the operation is successful.

Error Codes

See Error Codes.