DescribeFileUploadSignedUrl

Updated at:

Retrieves the signed URL required to upload a file.

Try it now

Try this API in OpenAPI Explorer, no manual signing needed. Successful calls auto-generate SDK code matching your parameters. Download it with built-in credential security for local usage.

Test

RAM authorization

The table below describes the authorization required to call this API. You can define it in a Resource Access Management (RAM) policy. The table's columns are detailed below:

  • Action: The actions can be used in the Action element of RAM permission policy statements to grant permissions to perform the operation.

  • API: The API that you can call to perform the action.

  • Access level: The predefined level of access granted for each API. Valid values: create, list, get, update, and delete.

  • Resource type: The type of the resource that supports authorization to perform the action. It indicates if the action supports resource-level permission. The specified resource must be compatible with the action. Otherwise, the policy will be ineffective.

    • For APIs with resource-level permissions, required resource types are marked with an asterisk (*). Specify the corresponding Alibaba Cloud Resource Name (ARN) in the Resource element of the policy.

    • For APIs without resource-level permissions, it is shown as All Resources. Use an asterisk (*) in the Resource element of the policy.

  • Condition key: The condition keys defined by the service. The key allows for granular control, applying to either actions alone or actions associated with specific resources. In addition to service-specific condition keys, Alibaba Cloud provides a set of common condition keys applicable across all RAM-supported services.

  • Dependent action: The dependent actions required to run the action. To complete the action, the RAM user or the RAM role must have the permissions to perform all dependent actions.

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

  • The original file name.

  • If the name ends with a forward slash (/), an empty folder is created. Subfolders are supported. When you create a folder, a file signature is not returned and the creation is completed automatically.

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: /abc/edf/hello.jpg

Note
  • If a file already exists at this path, it is overwritten.

  • You can also overwrite an existing file by providing its fileId or URL.

/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: The file is overwritten.

  • false: The file is not overwritten.

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 SpaceId parameters.

  • Step 2: Base64-encode the string.

  • Step 3: When uploading the file, include the x-oss-callback header and set its value to the Base64-encoded string from Step 2.

Important The ContentType request parameter is part of the signature calculation. When uploading the file, include the Content-Type header and ensure its value matches the ContentType request parameter.

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.