All Products
Search
Document Center

ApsaraVideo VOD:CreateUploadImage

Last Updated:Dec 14, 2022

Obtains a URL and a credential for uploading an image.

Operation Description

Description

  • You must obtain a URL and a credential before you upload a media file 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.
  • The upload credential is not automatically updated when you upload an image. By default, an upload credential is valid for 3,000 seconds before it expires. If your credential expires, call this operation again to obtain the credential.
  • 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.

Authorization information

The following table is the authorization information corresponding to the API, which can be found in the RAM permission policy statement.Action Used in the element to grant the RAM user or RAM role permission to call this API. The specific instructions are as follows:

  • 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 keyword: refers to the condition keyword defined by the cloud product itself.
  • 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.
Operateaccess levelResource typeconditional keywordAssociation operation
vod:CreateUploadImageWrite
  • VOD
    acs:vod:*:{#accountId}:*/*
    without
without
vod:CreateUploadImageWrite
    All resources
    without
without

Request parameters

ParameterTypeRequiredDescriptionExample
TitlestringNo

The title of the image. Take note of the following items:

  • 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.
NoteOnly images of the default type can be managed in the ApsaraVideo VOD console.
default
ImageExtstringNo

The file name extension of the image. Default value: png. Valid values:

  • png
  • jpg
  • jpeg
  • gif
png
TagsstringNo

The tags of the image. Take note of the following items:

  • 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.
Sample
StorageLocationstringNo

The storage location. Perform the following operations to obtain the storage location:

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 location.

NoteIf you specify a storage location, video files are uploaded to the specified location.
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. For example, you can specify callback configurations and upload acceleration configurations. The value is 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.
  • To use the upload acceleration feature, submit a ticket to enable this feature. For more information, see Overview.
  • {"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.
    image test
    AppIdstringNo

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

    app-1000000

    Response parameters

    ParameterTypeDescriptionExample
    object

    The returned data.

    FileURLstring

    The OSS URL of the file. The URL does not contain the information used for URL signing. You can set FileUrl to this URL 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.

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

    The URL of the image.

    NoteIf you enable the URL signing feature in ApsaraVideo VOD, the returned URL may not be accessible from a browser and an HTTP 403 status code may be returned. 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.

    NoteThe 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 media files. You need to parse UploadAuth only if you use the OSS SDK or call an OSS API operation to upload media files.
    eyJFbmmRCI6Im****

    Example

    Normal return example

    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 API error center.

    Change history

    Change timeSummary of changesOperate
    2022-10-27The input parameters of the API operation has changed
    Change itemChange content
    Input ParametersThe input parameters of the API operation has changed
      Added Input Parameters: OriginalFileName