All Products
Search
Document Center

Alibaba Cloud Model Studio:SubmitIndexAddDocumentsJob

Last Updated:Nov 28, 2024

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

You can run this interface directly in OpenAPI Explorer, saving you the trouble of calculating signatures. After running successfully, OpenAPI Explorer can automatically generate SDK code samples.

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.
OperationAccess levelResource typeCondition keyAssociated operation
sfm:SubmitIndexAddDocumentsJobcreate
*All Resources
*
    none
none

Request syntax

POST /{WorkspaceId}/index/add_documents_to_index HTTP/1.1

Request parameters

ParameterTypeRequiredDescriptionExample
WorkspaceIdstringYes

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
IndexIdstringYes

The primary key ID of the knowledge base, which is the Data.Id parameter returned by the CreateIndex operation.

79c0aly8zw
SourceTypestringYes

The data type of Data Management. For more information, see Create a knowledge base. Valid values:

  • DATA_CENTER_CATEGORY: The category type. Import all documents from one or more categories in Data Center.
  • DATA_CENTER_FILE: The document type. Import one or more documents from Data Center.
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
DocumentIdsarrayNo

The list of the primary key IDs of the documents.

stringNo

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
CategoryIdsarrayNo

The list of primary key IDs of the category.

stringNo

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

ParameterTypeDescriptionExample
object

Schema of Response

RequestIdstring

The request ID.

778C0B3B-03C1-5FC1-A947-36EDD13606AB
Dataobject

The data returned.

Idstring

The primary key ID of the task, JobId.

42687eb254a34802bed398357f5498ae
Statusstring

The HTTP status code returned.

200
Successboolean

Indications whether the API call is successful. Valid values:

  • true
  • false
true
Messagestring

The error message.

Required parameter(%s) missing or invalid, please check the request parameters.
Codestring

HTTP status code

Index.InvalidParameter

Examples

Sample success responses

JSONformat

{
  "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 codeError codeError message
400IdempotentParameterMismatchThe 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 timeSummary of changesOperation
No change history