All Products
Search
Document Center

ApsaraVideo VOD:CreateUploadImage

Last Updated:Dec 19, 2024

Queries a URL and a credential for uploading an image.

Operation description

  • Make sure that you understand the billing method and price of ApsaraVideo VOD before you call this operation. You are charged storage fees after you upload media files to ApsaraVideo VOD. For more information, see Billing of media asset storage. If you have activated the acceleration service, you are charged acceleration fees when you upload media files to ApsaraVideo VOD. For more information, see Billing of acceleration traffic.
  • You must obtain a URL and a credential before you upload an image to ApsaraVideo VOD. ApsaraVideo VOD provides multiple upload methods. You can upload files by using server upload SDKs, client upload SDKs, URLs, Object Storage Service (OSS) API, or OSS SDKs. Each upload method has different requirements for obtaining upload URLs and credentials. For more information, see the "Usage notes" section of the Upload URLs and credentials topic.
  • You cannot refresh the upload URL or credential when you upload images. If the image upload credential expires, you can call this operation to obtain a new upload URL and credential. By default, the validity period of an image upload credential is 3,000 seconds.
  • You can call the CreateUploadAttachedMedia operation to upload image watermarks.
  • You can configure a callback for ImageUploadComplete to receive notifications about the image upload status.

Debugging

You can run this interface directly in OpenAPI Explorer, saving you the trouble of calculating signatures. After running successfully, OpenAPI Explorer can automatically generate SDK code samples.

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:
    • The required resource types are displayed in bold characters.
    • 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.
OperationAccess levelResource typeCondition keyAssociated operation
vod:CreateUploadImagecreate
*All Resources
*
    none
none

Request parameters

ParameterTypeRequiredDescriptionExample
TitlestringNo

The title of the image. The following rules apply:

  • The title can be up to 128 characters in length.
  • The value must be encoded in UTF-8.
mytitle
ImageTypestringYes

The type of the image. Valid values:

  • default: the default image type.
  • cover: the thumbnail.
Note You can manage only images of the default type in the ApsaraVideo VOD console.
default
ImageExtstringNo

The file name extension of the image. Valid values:

  • png (default)
  • jpg
  • jpeg
  • gif
png
OriginalFileNamestringNo

The name of the source file.

Note The name must contain a file name extension. The file name extension is not case-sensitive.
D:\picture_01.png
TagsstringNo

The tags of the image. The following rules apply:

  • Each tag can be up to 32 characters in length.
  • You can specify a maximum of 16 tags for an image.
  • Separate multiple tags with commas (,).
  • The value must be encoded in UTF-8.
test
StorageLocationstringNo

The storage address. Perform the following operations to obtain the storage address: Log on to the ApsaraVideo VOD console. In the left-side navigation pane, choose Configuration Management > Media Management > Storage. On the Storage page, view the storage address.

Note If you specify a storage address, media files are uploaded to the specified address.
outin-****..oss-cn-shanghai.aliyuncs.com
CateIdlongNo

The category ID of the image. You can use one of the following methods to obtain the category ID:

  • Log on to the ApsaraVideo VOD console. In the left-side navigation pane, choose Configuration Management > Media Management > Categories. On the Categories page, you can view the category ID of the image.
  • Obtain the value of CateId from the response to the AddCategory operation.
  • Obtain the value of CateId from the response to the GetCategories operation.
100036****
UserDatastringNo

The custom configurations, including callback configurations and upload acceleration configurations. The value must be a JSON string. For more information, see the "UserData: specifies the custom configurations for media upload" section of the Request parameters topic.

Note
  • The callback configurations take effect only after you specify the HTTP callback URL and select specific callback events in the ApsaraVideo VOD console. For more information about how to configure HTTP callback settings in the ApsaraVideo VOD console, see Configure callback settings.
  • If you want to enable the upload acceleration feature, submit a ticket. For more information, see Overview . For more information about how to submit a ticket, see Contact us.
  • {"MessageCallback":{"CallbackURL":"http://example.aliyundoc.com"},"Extend":{"localId":"xxx","test":"www"}}
    DescriptionstringNo

    The description of the image.

    • The description can be up to 1,024 characters in length.
    • The value must be encoded in UTF-8.
    The description of the image
    AppIdstringNo

    The ID of the application. Default value: app-1000000. For more information, see Overview .

    app-1000000

    Response parameters

    ParameterTypeDescriptionExample
    object

    The returned result.

    FileURLstring

    The OSS URL of the file. The URL does not contain the information used for URL signing. You can specify FileUrl when you call the AddWatermark operation.

    http://example.aliyundoc.com/cover/2017-34DB-4F4C-9373-003AA060****.png
    RequestIdstring

    The ID of the request.

    25818875-5F78-AEF6-D7393642****
    UploadAddressstring

    The upload URL.

    Note The returned upload URL is a Base64-encoded URL. You must decode the Base64-encoded URL before you use an SDK or call an API operation to upload auxiliary media assets. You need to parse UploadAddress only if you use the OSS SDK or call an OSS API operation to upload auxiliary media assets.
    eyJTZWN1cmuIjoiQ0FJU3p3TjF****
    ImageURLstring

    The URL of the image.

    Note If the returned URL is inaccessible from a browser and the HTTP 403 status code is returned, the URL signing feature in ApsaraVideo VOD is enabled. To resolve this issue, you can disable the URL signing feature or generate a signed URL.
    http://example.aliyundoc.com/cover/2017-34DB-4F4C-9373-003AA060****.png
    ImageIdstring

    The ID of the image file.

    93ab850b4f6f46e91d24d81d4****
    UploadAuthstring

    The upload credential.

    Note The returned upload credential is a Base64-encoded value. You must decode the Base64-encoded credential before you use an SDK or call an API operation to upload auxiliary media assets. You need to parse UploadAuth only if you use the OSS SDK or call an OSS API operation to upload auxiliary media assets.
    eyJFbmmRCI6Im****

    Examples

    Sample success responses

    JSONformat

    {
      "FileURL": "http://example.aliyundoc.com/cover/2017-34DB-4F4C-9373-003AA060****.png",
      "RequestId": "25818875-5F78-AEF6-D7393642****",
      "UploadAddress": "eyJTZWN1cmuIjoiQ0FJU3p3TjF****",
      "ImageURL": "http://example.aliyundoc.com/cover/2017-34DB-4F4C-9373-003AA060****.png",
      "ImageId": "93ab850b4f6f46e91d24d81d4****",
      "UploadAuth": "eyJFbmmRCI6Im****"
    }

    Error codes

    For a list of error codes, visit the Service error codes.

    Change history

    Change timeSummary of changesOperation
    2022-10-27The request parameters of the API has changedView Change Details