All Products
Search
Document Center

Alibaba Cloud Model Studio:AddFile

Last Updated:Nov 28, 2024

Imports an unstructured document stored in the temporary storage space to Data Management.

Operation description

Note After you call this operation, the used lease ID expires immediately. Do not use the same lease ID to submit new requests.
  • You must call this operation within 12 hours after you call the ApplyFileUploadLease operation. Otherwise, the lease expires and the request fails.
  • After you call this operation, the system parses and imports your document. The process takes some time.
  • 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:AddFilecreate
*All Resources
*
    none
none

Request syntax

PUT /{WorkspaceId}/datacenter/file HTTP/1.1

Request parameters

ParameterTypeRequiredDescriptionExample
LeaseIdstringYes

The lease ID, which corresponds to the FileUploadLeaseId parameter returned by the ApplyFileUploadLease operation.

68abd1dea7b6404d8f7d7b9f7fbd332d.1716698936847
ParserstringYes

The parser. Valid value:

  • DASHSCOPE_DOCMIND: Intelligent document parsing by Alibaba Cloud.
DASHSCOPE_DOCMIND
CategoryIdstringYes

The primary key ID of the category to which the document is uploaded. This parameter corresponds to the CategoryId returned by the AddCategory operation. You can also click the ID icon next to the category name on the Unstructured Data tab of the Data Management page to view the ID. You can set the parameter to default, which specifies the Default Category created by the system.

cate_cdd11b1b79a74e8bbd675c356a91ee3510024405
WorkspaceIdstringYes

The ID of the workspace to which the document is uploaded. On the homepage of the console, click the workspace Details icon in the upper-left corner to view the workspace ID.

ws_3AXoiweeTyTd03IN
TagsarrayNo

A list of tags associated with the document. The default value is null, which means no tags. You can specify up to 10 tags.

stringNo

The tag of the document. A tag can be up to 12 characters in length and can contain letters, digits, digits, underscores (_), and hyphens (-).

Product Introduction

Response parameters

ParameterTypeDescriptionExample
object

Schema of Response

Codestring

The status code.

DataCenter.FileTooLarge
Dataobject

The returned data fields.

FileIdstring

The primary key ID of the document. We recommend that you store the ID because it is required for all subsequent API operations related to this document.

file_9a65732555b54d5ea10796ca5742ba22_XXXXXXXX
Parserstring

The parser that is used to parse the document. Valid value:

  • DASHSCOPE_DOCMIND: Intelligent document parsing by Alibaba Cloud.
DASHSCOPE_DOCMIND
Messagestring

The error message.

User not authorized to operate on the specified resource.
RequestIdstring

The request ID.

778C0B3B-xxxx-5FC1-A947-36EDD13606AB
Statusstring

The HTTP status code.

200
Successboolean

Indications whether the call is successful. Valid values:

  • true
  • false
true

Examples

Sample success responses

JSONformat

{
  "Code": "DataCenter.FileTooLarge",
  "Data": {
    "FileId": "file_9a65732555b54d5ea10796ca5742ba22_XXXXXXXX",
    "Parser": "DASHSCOPE_DOCMIND"
  },
  "Message": "User not authorized to operate on the specified resource.",
  "RequestId": "778C0B3B-xxxx-5FC1-A947-36EDD13606AB",
  "Status": "200",
  "Success": true
}

Error codes

For a list of error codes, visit the Service error codes.