All Products
Search
Document Center

ApsaraVideo VOD:Quick Start

Last Updated:Jan 27, 2026

This topic provides a complete example of calling an API operation using the Java software development kit (SDK) to help you quickly understand the integration steps.

Review the OpenAPI documentation

Before you begin, review the Obtain audio and video upload URLs and credentials API reference to understand the parameters and permissions required for the API call. For more information, see API Overview.

Create a RAM user and grant permissions

Identity

You can use an Alibaba Cloud account, a Resource Access Management (RAM) user, or a RAM role to call the API. For more information about the differences among these identities, see Identities, credentials, and authorization.

This example uses a RAM user to call the API operation.

  1. Log on to the Resource Access Management console and create a RAM user that can only make API calls. For more information, see Create a RAM user.

Grant permissions

  1. Go to the RAM User List page and click Add Permissions in the Actions column for the desired RAM user.

  2. In the text box, enter the keyword VOD and select the AliyunVODUploadAuth policy.

    Note

    AliyunVODFullAccess: Grants full management permissions on ApsaraVideo VOD.

    AliyunVODReadOnlyAccess: Grants read-only permissions on ApsaraVideo VOD.

    AliyunVODPlayAuth: Grants playback permissions on ApsaraVideo VOD.

    AliyunVODUploadAuth: Grants upload permissions on ApsaraVideo VOD.

    To create a custom permission policy, see Authorization Information.

  3. Click Confirm New Authorization to complete the authorization.

Call the API operation

This topic provides an example of how to call an OpenAPI operation using the Java SDK. The process is similar for SDKs in other languages. For more information, see ApsaraVideo VOD SDK. You can also call the API using other methods. For more information, see Methods to call an API.

Configure environment variables

Configure the ALIBABA_CLOUD_ACCESS_KEY_ID and ALIBABA_CLOUD_ACCESS_KEY_SECRET environment variables. For more information, see Configure environment variables on Linux, macOS, and Windows.

Download the sample code

  1. Go to CreateUploadVideo.

  2. On the Parameter Settings tab on the left, enter the required parameter information.

    1. Set FileName to product-introduction.mp4.

    2. Set Title to Product Introduction.

  3. On the SDK Examples tab on the right, select v2.0 for the SDK version, select Java as the language, and then click Download Full Project to download the sample code package.

  4. Decompress the package and navigate to the alibabacloud_sample directory.

Open the project

Load the project in IntelliJ IDEA. After the dependencies are loaded, open the src/main/java/com/aliyun/sample/Sample.java file and add code to print the return value as indicated by the comments.

Run the project

Click the Run button in the upper-right corner of the IDE to view the output log. The following content is returned:

{
  "headers": {
    "access-control-allow-origin": "*",
    "date": "Wed, 12 Jul 2023 01:01:15 GMT",
    "keep-alive": "timeout=25",
    "transfer-encoding": "chunked",
    "vary": "Accept-Encoding",
    "x-acs-request-id": "DB669C38-72B2-539C-87E2-76D1E3AAC3E2",
    "connection": "keep-alive",
    "content-type": "application/json;charset=utf-8",
    "access-control-expose-headers": "*",
    "x-acs-trace-id": "a40b3573c2e372121a05767e5bfe****"
  },
  "body": {
    "UploadAddress": "***",
    "VideoId": "***",
    "RequestId": "DB669C38-72B2-539C-87E2-76D1E3AAC3E2",
    "UploadAuth": "***"
  },
  "statusCode": 200
}