Adds parsed documents to an unstructured knowledge base.
Operation description
- You must first upload documents to Data Management and obtain the
FileId
. The documents are the knowledge source of the knowledge base. For more information, see Import Data. - Before you call this operation, make sure that your knowledge base is created and is not deleted. That is, the primary key ID of the knowledge base
IndexId
is valid. - After you call this operation, you can call the GetIndexJobStatus operation to query the status of the job. More than 20 calls to the GetIndexJobStatus operation per minute may trigger throttling.
- Execution takes a period of time after this operation is called. Do not make new request before the request is returned. This interface is not idempotent.
Debugging
Authorization information
The following table shows the authorization information corresponding to the API. The authorization information can be used in the Action
policy element to grant a RAM user or RAM role the permissions to call this API operation. Description:
- Operation: the value that you can use in the Action element to specify the operation on a resource.
- Access level: the access level of each operation. The levels are read, write, and list.
- Resource type: the type of the resource on which you can authorize the RAM user or the RAM role to perform the operation. Take note of the following items:
- The required resource types are displayed in bold characters.
- If the permissions cannot be granted at the resource level,
All Resources
is used in the Resource type column of the operation.
- Condition Key: the condition key that is defined by the cloud service.
- Associated operation: other operations that the RAM user or the RAM role must have permissions to perform to complete the operation. To complete the operation, the RAM user or the RAM role must have the permissions to perform the associated operations.
Operation | Access level | Resource type | Condition key | Associated operation |
---|---|---|---|---|
sfm:SubmitIndexAddDocumentsJob | create | *All Resources * |
| none |
Request syntax
POST /{WorkspaceId}/index/add_documents_to_index HTTP/1.1
Request parameters
Parameter | Type | Required | Description | Example |
---|---|---|---|---|
WorkspaceId | string | Yes | The ID of the workspace to which the knowledge base belongs. To view the workspace ID, you can click the Workspace Details icon in the upper-left corner on the homepage of the console. | ws_3Nt27MYcoK191ISp |
IndexId | string | Yes | The primary key ID of the knowledge base, which is the | 79c0aly8zw |
SourceType | string | Yes | The data type of Data Management. For more information, see Create a knowledge base. Valid values:
Note
If this parameter is set to DATA_CENTER_CATEGORY, you must specify the CategoryIds parameter. If this parameter is set to DATA_CENTER_FILE, you must specify the DocumentIds parameter.
| DATA_CENTER_FILE |
DocumentIds | array | No | The list of the primary key IDs of the documents. | |
string | No | The primary key ID of the document. To view the ID, you can click the ID icon next to the file name on the Data Management page. | doc_ea4a504d9ce545508d8aa6d90371bf5410021401 | |
CategoryIds | array | No | The list of primary key IDs of the category. | |
string | No | The primary key ID of the category. To view the category ID, you can click the ID icon next to the category name on the Unstructured Data tab of the Data Management page. | cate_21a407a3372c4ba7aedc649709143f0c10021401 |
Response parameters
Examples
Sample success responses
JSON
format
{
"RequestId": "778C0B3B-03C1-5FC1-A947-36EDD13606AB",
"Data": {
"Id": "42687eb254a34802bed398357f5498ae"
},
"Status": "200",
"Success": true,
"Message": "Required parameter(%s) missing or invalid, please check the request parameters.",
"Code": "Index.InvalidParameter"
}
Error codes
HTTP status code | Error code | Error message |
---|---|---|
400 | IdempotentParameterMismatch | The request uses the same client token as a previous, but non-identical request. Do not reuse a client token with different requests, unless the requests are identical. |
For a list of error codes, visit the Service error codes.
Change history
Change time | Summary of changes | Operation |
---|