Skip to content

ApplyFileUploadLease

Applies for a document upload lease to upload a document. You cannot use the API to upload structured documents. Use the console instead.

Operation description

  • This operation returns an HTTP URL that can be used to upload an unstructured document (the lease) and parameters required for the upload. Structured documents are not supported.
  • The HTTP URL returned by this operation is valid only for minutes. Upload the document before the URL expires.
  • After you apply for a lease and upload a document, the document is stored in a temporary storage space for 12 hours.
  • 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. Debug

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:
    • For mandatory resource types, indicate with a prefix of * .
    • 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:ApplyFileUploadLeasenone* All Resources *nonenone

Request syntax

POST /{WorkspaceId}/datacenter/category/{CategoryId} HTTP/1.1

Request parameters

ParameterTypeRequiredDescriptionExample
CategoryIdstringYesThe primary key ID of the category to which the uploaded document belongs. You can 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
FileNamestringYesThe name of the uploaded document, including the extension. Supported formats: pdf, doc, docx, md, txt, ppt, and pptx. The document name must be 4 to 128 characters in length.
Md5stringYesThe MD5 value of the uploaded document. This parameter is verified by the server (not in the current version).19657c391f6c70bcea63c154d8606bb3
SizeInBytesstringYesThe size of the uploaded document, in bytes. This parameter is verified by the server (not in the current version). Valid values: 1 to 100000000.1000
WorkspaceIdstringYesThe ID of the workspace to which the uploaded document belongs. On the homepage of the console, click the workspace Details icon in the upper-left corner to view the workspace ID.ws_3AXoiweeTyTd03IN

Response parameters

ParameterTypeDescriptionExample
objectSchema of Response
CodestringThe status code.DataCenter.FileTooLarge
DataobjectThe returned data fields.
FileUploadLeaseIdstringThe unique ID of the lease.1e6a159107384782be5e45ac4759b247.1719325231035
ParamobjectThe HTTP request parameters used to upload the document.
HeadersanyThe key-value pair to be placed in the Header. Both the key and the value are strings."X-bailian-extra": "MTAwNTQyNjQ5NTE2OTE3OA==", "Content-Type": "application/pdf"
MethodstringThe HTTP call method. Valid values: - PUT - POSTPUT
UrlstringThe upload URL of the document.https://bailian-datahub-data-origin-prod.oss-cn-hangzhou.aliyuncs.com/1005426495169178/10024405/68abd1dea7b6404d8f7d7b9f7fbd332d.1716698936847.pdf?Expires=1716699536&OSSAccessKeyId=TestID&Signature=HfwPUZo4pR6DatSDym0zFKVh9Wg%3D
TypestringThe upload method of the document. Valid values: - OSS.PreSignedURL - HTTPHTTP
MessagestringThe error message.User not authorized to operate on the specified resource
RequestIdstringThe request ID.778C0B3B-xxxx-5FC1-A947-36EDD13606AB
StatusstringThe HTTP status code.200
SuccessbooleanIndications whether the call is successful. Valid values: - true - falsetrue

Examples

Sample success responses

JSONformat

{
  "Code": "DataCenter.FileTooLarge",
  "Data": {
    "FileUploadLeaseId": "1e6a159107384782be5e45ac4759b247.1719325231035",
    "Param": {
      "Headers": "        \"X-bailian-extra\": \"MTAwNTQyNjQ5NTE2OTE3OA==\",\n        \"Content-Type\": \"application/pdf\"",
      "Method": "PUT",
      "Url": "https://bailian-datahub-data-origin-prod.oss-cn-hangzhou.aliyuncs.com/1005426495169178/10024405/68abd1dea7b6404d8f7d7b9f7fbd332d.1716698936847.pdf?Expires=1716699536&OSSAccessKeyId=TestID&Signature=HfwPUZo4pR6DatSDym0zFKVh9Wg%3D"
    },
    "Type": "HTTP"
  },
  "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.

Change history

Change timeSummary of changesOperation

No change history

Mirror of Alibaba Cloud Model Studio docs for reference and RAG. Not affiliated with Alibaba Cloud.