1.1.1-Robot Dialog Openapi-http
1. Overview
Interface Name: Robot Dialog-http Interface
Version number: v1.0.0
2. Information
Request method: POST
Request URL: https://DOMAIN/openapi/v1/conversation/dialog/
Domain: Refer to "Service address description"
3. Request parameters
Request header http header field:
Content-Type
string
Yes
Fixedapplication/json
cybertron-robot-key
string
Yes
Robot key
cybertron-robot-token
string
Yes
Robot token
extra-header
string
No
When calling a user-defined plugin server, the extra-header will be auto passed in http headers, and user can process by himself in the plugin server
Request body field:
username
string
Yes
User account
question
string
Yes
Dialog question
segment_code
string
No
Session code (new parameter added in version 1.3.20), the dialog history can be divided through this parameter. This parameter can be obtained by calling Get session information Interface creation or obtaining session history. Non-must pass field. If this field is not passed, the system will query the latest session through the user id and robot id. If it cannot be found, it will be automatically created
extra-body
string
No
When calling a user-defined plugin server, extra-body will be placed in http body, and user can process it by himself in the plugin server
4. Response field description
HTTP status code: 200 OK
Response field description:
code
string
"000000" is normal, other exceptions
message
string
Status description
data
object
message body
type
string
stringWhen answer is a string, the result is taken directly;jsonWhen answer is a json object, see the plugin description for internal data
dialog_id
string
dialog id
answer.type
string
reference plugin, can get valuemarkdown、chart;In addition, there isonline_search|image;Refer to the following example
answer.data
-
Reference Plugin
5. Example
Example 1-General
Request Example:
curl 'https://_DOMAIN_/openapi/v1/conversation/dialog/' \
-H 'Content-Type: application/json' \
-H 'cybertron-robot-key: l8ia2IOc************Z724%2BU%3D' \
-H 'cybertron-robot-token: MTc0Mzk5************************************************cGRCUTg9' \
-X POST -d '{
"username": "me@host.com",
"question": "Writing a 10-line poem",
"segment_code": "wWkE3bNkL3SzJX9orcO9P"
}'Response example:
{
"code": "000000",
"message": "success",
"data": {
"type": "string",
"dialog_id": "1796144693043560448",
"Answer": "Survey in the vast sea of people, \nSearch for the home of the soul.\nTime passes by, time flies, \nWhat is left is a touch of sadness.\nI hope the years are peaceful and the dreams in my heart will never grow old.\nCarefully chase, not fear difficulties, \nLet life bloom brilliantly.\nMay every day be full of hope, \nLet our hearts fly freely."
}
}Last updated