Description
You can call this operation to obtain the upload URL and credential for an image.
Request parameters
Name | Type | Required | Description |
---|---|---|---|
Action | String | Yes | The operation that you want to perform. Set this parameter to CreateUploadImage. |
ImageType | String | Yes | The type of the image. Valid values:
|
ImageExt | String | No | The file name extension of the image. Valid values:
|
Title | String | No | The title of the image. Rules:
|
Tags | String | No | The tag of the image. Rules:
|
CateId | Long | No | The ID of the category. To view or edit the category ID, log on to the ApsaraVideo for VOD console and choose Global Settings > Categories in the left-side navigation pane. |
Description | String | No | The description of the image.
|
StorageLocation | String | No | The bucket. If you specify this parameter, the image file is uploaded to the specified bucket. To view the bucket, log on to the ApsaraVideo for VOD console and click Storage in the left-side navigation pane. |
UserData | UserData | No | The custom configurations, such as the callback configuration. The value is a JSON-formatted string. |
AppId | String | No | The ID of the application, in app-xxxxxxx format. Default value: app-1000000. For more information, see Multi-application system. |
Response parameters
Name | Type | Description |
---|---|---|
RequestId | String | The ID of the request. |
UploadAddress | String | The upload URL. |
UploadAuth | String | The upload credential. |
ImageURL | String | The URL of the image. |
ImageId | String | The ID of the image. |
Note:
- This operation does not upload image files. To upload a file, you need to obtain the upload URL and credential for the file, and then use an upload SDK to upload it. The process is the same as that of uploading videos.
- Upload image watermarks through the CreateUploadAttachedMedia operation.
- If the image upload credential expires, call this operation again to obtain the upload URL and a new upload credential. The validity period of an upload credential is 3,000 seconds.
- If you have enabled the domain name authentication feature of ApsaraVideo for VOD, you cannot access the returned ImageURL in a browser and the HTTP status code 403 is returned. To resolve this issue, you can disable URL signing or generate a signed URL.
- For more information, see Upload URL and credential.
API examples
Sample request
http://vod.cn-shanghai.aliyuncs.com/?Action=CreateUploadImage&ImageType=cover&Format=JSON&<Common request parameters>
Note: For more information about common request parameters, see Common parameters.
Sample response
JSON format
{
"RequestId": "25818875-5F78-4A13-BEF6-D7393642CA58",
"ImageId": "93ab850b4f6f44eab54b6e91d24d81d4",
"UploadAddress": "eyJTZWN1cml0eVRva2VuIjoiQ0FJU3p3TjF",
"UploadAuth": "eyJFbmRwb2ludCI6Im",
"ImageURL": "http://aliyun.com/cover/2017-06-20-20-42-48_86DB3A58-08FB-4F4C-9373-003AA06012EA.png"
}
SDK examples
We recommend that you use a server SDK to call this operation. For more information about the sample code used to call this operation in various languages, see the following topics: