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
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.
Operation | Access level | Resource type | Condition key | Associated operation |
---|---|---|---|---|
sfm:ApplyFileUploadLease | none | *All Resources * |
| none |
Request syntax
POST /{WorkspaceId}/datacenter/category/{CategoryId} HTTP/1.1
Request parameters
Parameter | Type | Required | Description | Example |
---|---|---|---|---|
CategoryId | string | Yes | The 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 |
FileName | string | Yes | The 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. | |
Md5 | string | Yes | The MD5 value of the uploaded document. This parameter is verified by the server (not in the current version). | 19657c391f6c70bcea63c154d8606bb3 |
SizeInBytes | string | Yes | The 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 |
WorkspaceId | string | Yes | The 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
Examples
Sample success responses
JSON
format
{
"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.