DescribeFileUploadSignedUrl
Retrieves the signed URL required to upload a file.
Try it now
Test
RAM authorization
|
Action |
Access level |
Resource type |
Condition key |
Dependent action |
|
mpserverless:DescribeFileUploadSignedUrl |
create |
*All Resource
|
None | None |
Request parameters
|
Parameter |
Type |
Required |
Description |
Example |
| Filename |
string |
Yes |
|
wlop29.jpg |
| Size |
integer |
Yes |
The file size in bytes. |
41836 |
| SpaceId |
string |
Yes |
The service space ID. |
mp-0e16bb12-14af-****-b24c-5ac1a9a7bb9f |
| ContentType |
string |
Yes |
The file type. Examples: .pdf, .xls, .xlsx, .doc, .docx, .ppt, .pptx, and .txt. |
png |
| FileId |
string |
No |
The custom path to upload the file. Subfolders are supported. The path can contain letters, digits, Chinese characters, hyphens (-), underscores (_), and periods (.). The total length cannot exceed 1,024 characters. The path must start with a forward slash (/). Example:
Note
|
/abc/edf/hello.jpg |
Response elements
|
Element |
Type |
Description |
Example |
|
object |
|||
| SignUrl |
string |
The URL to upload the file. |
https://bsppub.oss-cn-shanghai.aliyuncs.com/FBPSBVMO-myspace/41552d60-52de-xxx-a713-43e879b0717a.JPG?OSSAccessKeyId=LTAI****************&Expires=1582152512&Signature=sek1B0Xm2r***tNvfX9tX%2BBJxA%3D |
| RequestId |
string |
The request ID. |
E9A50E1B-5ECE-42D4-B261-C07D1BBE68DE |
| Id |
string |
The unique ID of the file. |
2fada31e-8fa5-****-b595-9698cd6b5f06 |
| OssCallbackUrl |
string |
The webhook address for the upload result. |
https://api.next.bspapp.com/oss_upload_callback |
| Overwrite |
boolean |
Indicates whether the upload request overwrites the file.
|
true |
After you retrieve the signed upload URL (SignUrl), use the PUT method to upload the file to that URL. The PUT request must include the webhook address parameter in the headers. Construct the parameter as follows:
Step 1: Construct the string {"callbackUrl":"....","callbackBody":"{\"fileId\":\"....\",\"spaceId\":\"....\"}","callbackBodyType":"application/json"}. Replace the placeholders with the values of the OssCallbackUrl, Id, and
SpaceIdparameters.Step 2: Base64-encode the string.
Step 3: When uploading the file, include the
x-oss-callbackheader and set its value to the Base64-encoded string from Step 2.
Examples
Success response
JSON format
{
"SignUrl": "https://bsppub.oss-cn-shanghai.aliyuncs.com/FBPSBVMO-myspace/41552d60-52de-xxx-a713-43e879b0717a.JPG?OSSAccessKeyId=LTAI****************&Expires=1582152512&Signature=sek1B0Xm2r***tNvfX9tX%2BBJxA%3D",
"RequestId": "E9A50E1B-5ECE-42D4-B261-C07D1BBE68DE",
"Id": "2fada31e-8fa5-****-b595-9698cd6b5f06",
"OssCallbackUrl": "https://api.next.bspapp.com/oss_upload_callback",
"Overwrite": true
}
Error codes
See Error Codes for a complete list.
Release notes
See Release Notes for a complete list.