Add Table Data
Add Table Data
This API supports adding up to 1000 rows of data in a single operation to the specified Agent's data table for use and query in conversations.
Note:
- The value length of the field with
unique
enabled cannot exceed 256 characters.- The value length of the field without
unique
enabled cannot exceed 4294967295 characters (actually limited by network issues, it is recommended to control the data length).- Data transmitted through the API will be converted to CSV format. The CSV file size must not exceed 10 MB.
Request Method
POST
Endpoint
https://api-${endpoint}.gptbots.ai/v1/database/import/records
Authentication
Refer to the API Overview for the authentication method explanation.
Request
Request Example
curl -X POST 'https://api-${endpoint}.gptbots.ai/v1/database/import/records' \
-H 'Authorization: Bearer ${API Key}' \
-H 'Content-Type: application/json' \
-d '{
"table_id": "673af861ed69656ac0895b07",
"records": [
{
"values": {
"id": "7424489",
"name": "4455566777777"
}
},
{
"values": {
"id": "7852549",
"name": "446656677665"
}
}
]
}'
curl -X POST 'https://api-${endpoint}.gptbots.ai/v1/database/import/records' \
-H 'Authorization: Bearer ${API Key}' \
-H 'Content-Type: application/json' \
-d '{
"table_id": "673af861ed69656ac0895b07",
"records": [
{
"values": {
"id": "7424489",
"name": "4455566777777"
}
},
{
"values": {
"id": "7852549",
"name": "446656677665"
}
}
]
}'
This code block in the floating window
Request Headers
Field | Type | Description |
---|---|---|
Authorization | Bearer ${API Key} | Use Authorization: Bearer ${API Key} for authentication. Get API key from API Key page. |
Content-Type | application/json | Data type, set to application/json. |
Important:
- When unique fields exist in the data table, all unique fields must be included in the records.
- Values for unique fields in records must not be duplicated, empty, or already exist in the database, otherwise an error will occur and the data will be discarded.
Request Body
Field | Type | Required | Description |
---|---|---|---|
records | list | Yes | The collection of data to be imported. |
table_id | string | Yes | ID of the table. |
Response
Response Example
{
"code": 0,
"message": "success",
"data": [
"673e9cda9f7bc178002dbd9c"
]
}
{
"code": 0,
"message": "success",
"data": [
"673e9cda9f7bc178002dbd9c"
]
}
This code block in the floating window
Successful Response
Field | Type | Description |
---|---|---|
code | int | The type code of the message. |
message | string | Description of the message. |
data | object | The task ID for this table data addition operation, only one ID will be returned. |
Failed Response
Field | Type | Description |
---|---|---|
code | int | Error code. |
message | string | Error details. |
Error Codes
Code | Message |
---|---|
40000 | Parameter error |
50000 | Internal system error |