Generate presigned URLs for multimedia resources

Updated at:

Description

Use this API to generate a temporary, secure presigned URL for media resources, such as audio, video, and images, stored in the AI Search Platform by providing the dataset ID and the primary key of a data record. The URL can be used directly for front-end display or for download.

Primary use case

When you use the Search API with an application created in the AI Search Platform, the URLs for images, audio, and video in the search results are presigned URLs. These URLs are valid for 24 hours.

If your application stores these URLs, they become invalid when they expire. To generate a new, valid presigned URL, call this API with the corresponding dataset ID and primary key.

Request parameters

Parameter

Type

Description

body

object

The request body.

Example:

{

"datasetId": 730,

"primaryKey": "01KQCJBPM9JVDTXWV50G2AK"

}

datasetId

string

The dataset ID. You can find this ID in the Dataset List in the console.

Example: 730

primaryKey

string

The primary key of the data record in the dataset.

Example: 01KQCJBPM9JVDTXWV50G2AK

Response parameters

Parameter

Type

Description

code

integer<int32>

The business status code. A value of 200 indicates that the request was successful. Other values indicate an error. For more information, see Error codes.

Example: 200

message

string

Returns success for a successful request or a specific error message if the request fails.

Example: success

data

object

The data payload of the response.

url

string

An OSS presigned URL that includes a signature and an expiration time. The URL is valid for 24 hours and can be used directly for display or download.

Example: https://maas-ai-search-center-raw.oss-cn-hangzhou.aliyun.com/sample.mp4...

requestId

string

The unique request ID. You can use this ID to troubleshoot issues.

Example: 1a0f40dd17774641794394269ec0e9

Response example

{
  "code": 200,
  "message": "success",
  "data": {
    "url": "https://maas-ai-search-center-raw.oss-cn-hangzhou.aliyuncs.com/.../sample.mp4..."
  },
  "requestId": "1a0f40da17774667074596639ec2b6"
}

Error codes

Error code

Message

Description

Recommended action

400

datasetId: must not be null

The request parameters are incomplete or incorrectly formatted. For example, the required datasetId parameter is missing.

Check your request to ensure that all required parameters are provided and correctly formatted.

403

Access denied

Access is denied, typically due to failed authentication or insufficient permissions.

Verify that your Access Key and other authentication credentials are correct, and that you have the necessary permissions to perform the operation.

404

Dataset not found

The specified dataset does not exist.

Check whether the datasetId in the request is correct.

404

Resource not found

No record with the specified primary key exists in the target dataset.

Check that the primaryKey in your request is correct.

404

Resource file not found

A record with the specified primary key exists, but its associated file is missing. This can occur if the rawFilePath field is empty, or if the file in OSS has been deleted or is otherwise inaccessible. This prevents the generation of a presigned URL.

Verify that the specified file is stored correctly and is accessible.

500

Internal server error

An unknown internal server error occurred.

Try the request again later. If the problem persists, contact technical support.