All Products
Search
Document Center

ApsaraVideo VOD:Media upload

Last Updated:Jan 28, 2026

ApsaraVideo VOD provides a comprehensive set of server-side upload APIs that allow developers to upload media files using various methods. This topic describes the scenarios and provides code examples for calling server-side upload APIs using the Java software development kit (SDK).

Scenarios

Important

This topic provides only the examples of calling API operations, such as the operation for obtaining an upload credential and an upload URL. The following table describes the scenarios in which API operations can be called to upload media files.

API operation

Scenario

CreateUploadVideo

  • If you upload media files by using Object Storage Service (OSS) SDKs, you must use the ApsaraVideo VOD SDK and call an operation to obtain an upload credential and an upload URL. The obtained URL and credential are Base64-encoded and must be decoded before they are used to initialize an OSSClient instance. For more information, see Upload using OSS SDK. The preceding topic provides complete sample code for uploading media files by using OSS SDK for Java. For more information about the sample code in other languages, see Upload media files using ApsaraVideo VOD APIs.

  • If you upload media files from clients by using the upload SDK, you need to integrate the ApsaraVideo VOD SDK and call an operation to obtain or update an upload credential and an upload URL. You can issue URLs and credentials to clients without the need to decode them. For more information, see Upload from clients.

RefreshUploadVideo

CreateUploadImage

CreateUploadAttachedMedia

UploadMediaByURL

  • You can call the UploadMediaByURL operation to upload media files by using the URLs of source files. This way, you do not need to download media files to your servers or devices before you use the upload SDK to upload the media files to ApsaraVideo VOD.

    Note

    The URL-based upload jobs are asynchronous. After you submit a URL-based upload job, it may take hours, even days to complete.

  • You can call the GetURLUploadInfos operation to query the progress of URL-based upload jobs.

GetURLUploadInfos

Register media assets

Prerequisites

API call notes

  • In this topic, an AccessKey pair is used to initialize a client instance in the code examples.

  • For detailed descriptions of the API parameters and returned fields, visit the Alibaba Cloud OpenAPI Portal and view the Documentation tab for each API.

  • This topic provides code examples for only some complex APIs. To obtain SDK code examples for other APIs, go to the Alibaba Cloud OpenAPI Portal. On the Parameter Settings tab on the left, enter the required parameter information and initiate the call. Then, on the SDK Sample tab on the right, select the SDK version and target language to view and download the sample code.

  • The API calls in this topic use SDK V1.0 as an example. To obtain SDK examples for V2.0, specify the corresponding SDK version when you obtain the sample code from the Alibaba Cloud OpenAPI Portal.image.png

API call examples

Get an upload URL and credential for an audio or video file

Call the CreateUploadVideo API to obtain an upload URL and credential for an audio or video file.

Alibaba Cloud OpenAPI Portal link: CreateUploadVideo.

Sample code:

import com.aliyuncs.DefaultAcsClient;
import com.aliyuncs.auth.AlibabaCloudCredentials;
import com.aliyuncs.auth.EnvironmentVariableCredentialsProvider;
import com.aliyuncs.exceptions.ClientException;
import com.aliyuncs.profile.DefaultProfile;
import com.aliyuncs.vod.model.v20170321.CreateUploadVideoRequest;
import com.aliyuncs.vod.model.v20170321.CreateUploadVideoResponse;

/**
 *
 * Sample code for obtaining an upload credential for an audio or video file
 */
public class AudioOrVideoCreateUploadDemo {

    /** 
     * Read the AccessKey information
     */
    public static DefaultAcsClient initVodClient() throws ClientException {
    // The region where ApsaraVideo VOD is activated.
    String regionId = "cn-shanghai";  
    // An AccessKey pair of an Alibaba Cloud account has permissions on all API operations. We recommend that you use a RAM user to call API operations or perform routine O&M.
    // We strongly recommend that you do not hard-code the AccessKey ID and AccessKey secret in your project code. Otherwise, the AccessKey pair may be leaked, which threatens the security of all your resources.
    // This example shows how to read the AccessKey pair from environment variables to authenticate API access. Before you run the sample code, configure the ALIBABA_CLOUD_ACCESS_KEY_ID and ALIBABA_CLOUD_ACCESS_KEY_SECRET environment variables.
    DefaultProfile profile = DefaultProfile.getProfile(regionId, System.getenv("ALIBABA_CLOUD_ACCESS_KEY_ID"), System.getenv("ALIBABA_CLOUD_ACCESS_KEY_SECRET"));
    DefaultAcsClient client = new DefaultAcsClient(profile);
    return client;
    }

    /**
     * Get an upload URL and credential for an audio or video file
     * @param client The client that sends the request
     * @return CreateUploadVideoResponse The response data for getting the upload URL and credential for an audio or video file
     * @throws Exception
     */
    public static CreateUploadVideoResponse createUploadVideo(DefaultAcsClient client) throws Exception {
        CreateUploadVideoRequest request = new CreateUploadVideoRequest();
        request.setTitle("this is a sample");
        request.setFileName("filename.mp4");

        // UserData: The user-defined parameter settings. Set this parameter when you need to specify a webhook address and pass-through data. This parameter is optional.
        //JSONObject userData = new JSONObject();

        // UserData callback settings
        // Message callback settings. If this parameter is set, it overrides the global event notification settings.
        //JSONObject messageCallback = new JSONObject();
        // Set the webhook address
        //messageCallback.put("CallbackURL", "http://192.168.0.1/16");
        // Set the callback method. Default value: http.
        //messageCallback.put("CallbackType", "http");
        //userData.put("MessageCallback", messageCallback.toJSONString());

        // UserData pass-through data settings
        // The user-defined extension field, which is passed through in the callback.
        //JSONObject extend = new JSONObject();
        //extend.put("MyId", "user-defined-id");
        //userData.put("Extend", extend.toJSONString());

        //request.setUserData(userData.toJSONString());

        return client.getAcsResponse(request);
    }
  
    /** 
     * Request example
     */
    public static void main(String[] argv) throws ClientException {
        try {
            DefaultAcsClient client = initVodClient();
            CreateUploadVideoResponse response = new CreateUploadVideoResponse();
            response = createUploadVideo(client);
            System.out.print("VideoId = " + response.getVideoId() + "\n");
            System.out.print("UploadAddress = " + response.getUploadAddress() + "\n");
            System.out.print("UploadAuth = " + response.getUploadAuth() + "\n");
            System.out.print("RequestId = " + response.getRequestId() + "\n");
        } catch (Exception e) {
            System.out.print("ErrorMessage = " + e.getLocalizedMessage());
        }
    }
}

Refresh the upload credential for an audio or video file

Call the RefreshUploadVideo API to refresh the upload credential for an audio or video file.

Alibaba Cloud OpenAPI Portal link: RefreshUploadVideo.

Sample code:

import com.aliyuncs.DefaultAcsClient;
import com.aliyuncs.auth.AlibabaCloudCredentials;
import com.aliyuncs.auth.EnvironmentVariableCredentialsProvider;
import com.aliyuncs.exceptions.ClientException;
import com.aliyuncs.profile.DefaultProfile;
import com.aliyuncs.vod.model.v20170321.RefreshUploadVideoRequest;
import com.aliyuncs.vod.model.v20170321.RefreshUploadVideoResponse;

/**
*
* Sample code for refreshing the upload credential for an audio or video file
*/
public class AudioOrVideoRefreshUploadDemo {

    /** 
     * Read the AccessKey information
     */
    public static DefaultAcsClient initVodClient() throws ClientException {
    // The region where ApsaraVideo VOD is activated.
    String regionId = "cn-shanghai";  
    // An AccessKey pair of an Alibaba Cloud account has permissions on all API operations. We recommend that you use a RAM user to call API operations or perform routine O&M.
    // We strongly recommend that you do not hard-code the AccessKey ID and AccessKey secret in your project code. Otherwise, the AccessKey pair may be leaked, which threatens the security of all your resources.
    // This example shows how to read the AccessKey pair from environment variables to authenticate API access. Before you run the sample code, configure the ALIBABA_CLOUD_ACCESS_KEY_ID and ALIBABA_CLOUD_ACCESS_KEY_SECRET environment variables.
    DefaultProfile profile = DefaultProfile.getProfile(regionId, System.getenv("ALIBABA_CLOUD_ACCESS_KEY_ID"), System.getenv("ALIBABA_CLOUD_ACCESS_KEY_SECRET"));
    DefaultAcsClient client = new DefaultAcsClient(profile);
    return client;
    }

    /**
     * Refresh the upload credential for an audio or video file
     * @param client The client that sends the request
     * @return RefreshUploadVideoResponse The response data for refreshing the upload credential for an audio or video file
     * @throws Exception
     */
    public static RefreshUploadVideoResponse refreshUploadVideo(DefaultAcsClient client) throws Exception {
        RefreshUploadVideoRequest request = new RefreshUploadVideoRequest();
        // The ID of the audio or video file
        request.setVideoId("<VideoId>");
        return client.getAcsResponse(request);
    }

    /** 
     * Request example
     */
    public static void main(String[] argv)  {

        try {
            DefaultAcsClient client = initVodClient();
            RefreshUploadVideoResponse response = refreshUploadVideo(client);
            System.out.print("VideoId = " + response.getVideoId() + "\n");
            System.out.print("UploadAddress = " + response.getUploadAddress() + "\n");
            System.out.print("UploadAuth = " + response.getUploadAuth() + "\n");
            System.out.print("RequestId = " + response.getRequestId() + "\n");
        } catch (Exception e) {
            System.out.print("ErrorMessage = " + e.getLocalizedMessage());
        }
    }
}

Get an upload URL and credential for an image

Call the CreateUploadImage API to obtain an upload URL and credential for an image.

Alibaba Cloud OpenAPI Portal link: CreateUploadImage.

Sample code:

import com.alibaba.fastjson.JSONObject;
import com.aliyuncs.DefaultAcsClient;
import com.aliyuncs.auth.AlibabaCloudCredentials;
import com.aliyuncs.auth.EnvironmentVariableCredentialsProvider;
import com.aliyuncs.exceptions.ClientException;
import com.aliyuncs.profile.DefaultProfile;
import com.aliyuncs.vod.model.v20170321.CreateUploadImageRequest;
import com.aliyuncs.vod.model.v20170321.CreateUploadImageResponse;

/**
 * Sample code for obtaining an upload credential for an image
 *
 */
public class ImageCreateUploadDemo {

    /** 
     * Read the AccessKey information
     */
    public static DefaultAcsClient initVodClient() throws ClientException {
    // The region where ApsaraVideo VOD is activated.
    String regionId = "cn-shanghai";  
    // An AccessKey pair of an Alibaba Cloud account has permissions on all API operations. We recommend that you use a RAM user to call API operations or perform routine O&M.
    // We strongly recommend that you do not hard-code the AccessKey ID and AccessKey secret in your project code. Otherwise, the AccessKey pair may be leaked, which threatens the security of all your resources.
    // This example shows how to read the AccessKey pair from environment variables to authenticate API access. Before you run the sample code, configure the ALIBABA_CLOUD_ACCESS_KEY_ID and ALIBABA_CLOUD_ACCESS_KEY_SECRET environment variables.
    DefaultProfile profile = DefaultProfile.getProfile(regionId, System.getenv("ALIBABA_CLOUD_ACCESS_KEY_ID"), System.getenv("ALIBABA_CLOUD_ACCESS_KEY_SECRET"));
    DefaultAcsClient client = new DefaultAcsClient(profile);
    return client;
    }

    /**
     * Get an upload URL and credential for an image
     * @param client The client that sends the request
     * @return CreateUploadImageResponse The response data for getting the upload URL and credential for an image
     * @throws Exception
     */
    public static CreateUploadImageResponse createUploadImage(DefaultAcsClient client) throws Exception {
        CreateUploadImageRequest request = new CreateUploadImageRequest();
        // Set the image type
        request.setImageType("default");
        // Set the image file name extension
        request.setImageExt("gif");
        // Set the image title
        request.setTitle("this is a sample");

        // UserData: The user-defined parameter settings. Set this parameter when you need to specify a webhook address and pass-through data. This parameter is optional.
        JSONObject userData = new JSONObject();

        // UserData callback settings
        // Message callback settings. If this parameter is set, it overrides the global event notification settings.
        JSONObject messageCallback = new JSONObject();
        // Set the webhook address
        messageCallback.put("CallbackURL", "http://192.168.0.0/16");
        // Set the callback method. Default value: http.
        messageCallback.put("CallbackType", "http");
        userData.put("MessageCallback", messageCallback.toJSONString());

        JSONObject extend = new JSONObject();
        extend.put("MyId", "user-defined-id");
        userData.put("Extend", extend.toJSONString());

        request.setUserData(userData.toJSONString());

        return client.getAcsResponse(request);
    }

    /** 
     * Request example
     */
    public static void main(String[] argv)  {

        try {
            DefaultAcsClient client = initVodClient();
            CreateUploadImageResponse response = createUploadImage(client);
            System.out.print("ImageId = " + response.getImageId() + "\n");
            System.out.print("ImageURL = " + response.getImageURL() + "\n");
            System.out.print("UploadAddress = " + response.getUploadAddress() + "\n");
            System.out.print("UploadAuth = " + response.getUploadAuth() + "\n");
            System.out.print("RequestId = " + response.getRequestId() + "\n");
        } catch (Exception e) {
            System.out.print("ErrorMessage = " + e.getLocalizedMessage());
        }
    }
}

Get an upload URL and credential for an auxiliary media asset

Call the CreateUploadAttachedMedia API to obtain an upload URL and credential for an auxiliary media asset.

Alibaba Cloud OpenAPI Portal link: CreateUploadAttachedMedia.

Sample code:

import com.alibaba.fastjson.JSONObject;
import com.aliyuncs.DefaultAcsClient;
import com.aliyuncs.auth.AlibabaCloudCredentials;
import com.aliyuncs.auth.EnvironmentVariableCredentialsProvider;
import com.aliyuncs.exceptions.ClientException;
import com.aliyuncs.profile.DefaultProfile;
import com.aliyuncs.vod.model.v20170321.CreateUploadAttachedMediaRequest;
import com.aliyuncs.vod.model.v20170321.CreateUploadAttachedMediaResponse;

/**
 * Sample code for obtaining an upload credential for an auxiliary media asset
 *
 */
public class AttachedMediaCreateUploadDemo {

     /** 
     * Read the AccessKey information
     */
    public static DefaultAcsClient initVodClient() throws ClientException {
    // The region where ApsaraVideo VOD is activated.
    String regionId = "cn-shanghai";
    // An AccessKey pair of an Alibaba Cloud account has permissions on all API operations. We recommend that you use a RAM user to call API operations or perform routine O&M.
    // We strongly recommend that you do not hard-code the AccessKey ID and AccessKey secret in your project code. Otherwise, the AccessKey pair may be leaked, which threatens the security of all your resources.
    // This example shows how to read the AccessKey pair from environment variables to authenticate API access. Before you run the sample code, configure the ALIBABA_CLOUD_ACCESS_KEY_ID and ALIBABA_CLOUD_ACCESS_KEY_SECRET environment variables.
    DefaultProfile profile = DefaultProfile.getProfile(regionId, System.getenv("ALIBABA_CLOUD_ACCESS_KEY_ID"), System.getenv("ALIBABA_CLOUD_ACCESS_KEY_SECRET"));
    DefaultAcsClient client = new DefaultAcsClient(profile);
    return client;
    }

    /**
     * Get an upload URL and credential for an auxiliary media asset (such as a watermark or caption)
     * @param client The client that sends the request
     * @return CreateUploadAttachedMediaResponse The response data for getting the upload URL and credential for an auxiliary media asset
     * @throws Exception
     */
    public static CreateUploadAttachedMediaResponse createUploadAttachedMedia(DefaultAcsClient client) throws Exception {
        CreateUploadAttachedMediaRequest request = new CreateUploadAttachedMediaRequest();
        // Set the business type
        request.setBusinessType("watermark");
        // Set the file name extension
        request.setMediaExt("gif");
        // Set the title
        request.setTitle("this is a sample");

        // UserData: The user-defined parameter settings. Set this parameter when you need to specify a webhook address and pass-through data. This parameter is optional.
        JSONObject userData = new JSONObject();

        // UserData callback settings
        // Message callback settings. If this parameter is set, it overrides the global event notification settings.
        JSONObject messageCallback = new JSONObject();
        // Set the webhook address
        messageCallback.put("CallbackURL", "http://192.168.0.0/16");
        // Set the callback type. Default value: http.
        messageCallback.put("CallbackType", "http");
        userData.put("MessageCallback", messageCallback.toJSONString());

        JSONObject extend = new JSONObject();
        extend.put("MyId", "user-defined-id");
        userData.put("Extend", extend.toJSONString());

        request.setUserData(userData.toJSONString());

        return client.getAcsResponse(request);
    }
    /** 
     * Request example
     */
    public static void main(String[] argv) {

        try {
            DefaultAcsClient client = initVodClient();
            CreateUploadAttachedMediaResponse response = createUploadAttachedMedia(client);
            System.out.print("mediaId = " + response.getMediaId() + "\n");
            System.out.print("mediaURL = " + response.getMediaURL() + "\n");
            System.out.print("UploadAddress = " + response.getUploadAddress() + "\n");
            System.out.print("UploadAuth = " + response.getUploadAuth() + "\n");
            System.out.print("RequestId = " + response.getRequestId() + "\n");
        } catch (Exception e) {
            System.out.print("ErrorMessage = " + e.getLocalizedMessage());
        }
    }
}

Batch upload by URL

Call the UploadMediaByURL API to perform a batch upload by URL.

Alibaba Cloud OpenAPI Portal link: UploadMediaByURL.

Sample code:

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.aliyuncs.DefaultAcsClient;
import com.aliyuncs.auth.AlibabaCloudCredentials;
import com.aliyuncs.auth.EnvironmentVariableCredentialsProvider;
import com.aliyuncs.exceptions.ClientException;
import com.aliyuncs.profile.DefaultProfile;
import com.aliyuncs.vod.model.v20170321.UploadMediaByURLRequest;
import com.aliyuncs.vod.model.v20170321.UploadMediaByURLResponse;

import java.net.URLEncoder;

/**
 * Sample code for the batch upload by URL feature
 *
 */
public class AudioOrVideoUploadByUrl {

    /** 
     * Read the AccessKey information
     */
    public static DefaultAcsClient initVodClient() throws ClientException {
    // The region where ApsaraVideo VOD is activated.
    String regionId = "cn-shanghai"; 
    // An AccessKey pair of an Alibaba Cloud account has permissions on all API operations. We recommend that you use a RAM user to call API operations or perform routine O&M.
    // We strongly recommend that you do not hard-code the AccessKey ID and AccessKey secret in your project code. Otherwise, the AccessKey pair may be leaked, which threatens the security of all your resources.
    // This example shows how to read the AccessKey pair from environment variables to authenticate API access. Before you run the sample code, configure the ALIBABA_CLOUD_ACCESS_KEY_ID and ALIBABA_CLOUD_ACCESS_KEY_SECRET environment variables.
    DefaultProfile profile = DefaultProfile.getProfile(regionId, System.getenv("ALIBABA_CLOUD_ACCESS_KEY_ID"), System.getenv("ALIBABA_CLOUD_ACCESS_KEY_SECRET"));
    DefaultAcsClient client = new DefaultAcsClient(profile);
    return client;
    }

    /**
     * Batch upload by URL
     *
     * @param client The client that sends the request
     * @return UploadMediaByURLResponse The response data for the batch upload by URL
     * @throws Exception
     */
    public static UploadMediaByURLResponse uploadMediaByURL(DefaultAcsClient client) throws Exception {
        UploadMediaByURLRequest request = new UploadMediaByURLRequest();
        String url = "http://video_01.mp4";
        String encodeUrl = URLEncoder.encode(url, "UTF-8");
        // The URL of the video source file
        request.setUploadURLs(encodeUrl);

        // The metadata of the video to upload
        JSONObject uploadMetadata = new JSONObject();
        // The URL of the video source file to upload. This must match a URL in UploadURLs to take effect.
        uploadMetadata.put("SourceUrl", encodeUrl);
        // The video title
        uploadMetadata.put("Title", "upload by url sample");

        JSONArray uploadMetadataList = new JSONArray();
        uploadMetadataList.add(uploadMetadata);
        request.setUploadMetadatas(uploadMetadataList.toJSONString());

        // UserData: The user-defined parameter settings. Set this parameter when you need to specify a webhook address and pass-through data. This parameter is optional.
        JSONObject userData = new JSONObject();

        // UserData callback settings
        // Message callback settings. If this parameter is set, it overrides the global event notification settings.
        JSONObject messageCallback = new JSONObject();
        // Set the webhook address
        messageCallback.put("CallbackURL", "http://192.168.0.0/16");
        // Set the callback type. Default value: http.
        messageCallback.put("CallbackType", "http");
        userData.put("MessageCallback", messageCallback.toJSONString());

        JSONObject extend = new JSONObject();
        extend.put("MyId", "user-defined-id");
        userData.put("Extend", extend.toJSONString());

        request.setUserData(userData.toJSONString());

        return client.getAcsResponse(request);
    }

    /** 
     * Request example
     */
    public static void main(String[] argv) {

        try {
            DefaultAcsClient client = initVodClient();
            UploadMediaByURLResponse response = uploadMediaByURL(client);
            System.out.print("UploadJobs = " + JSON.toJSONString(response.getUploadJobs()) + "\n");
            System.out.print("RequestId = " + response.getRequestId() + "\n");
        } catch (Exception e) {
            System.out.print("ErrorMessage = " + e.getLocalizedMessage());
        }
    }

}

Register media asset information

Call the RegisterMedia API to register media asset information.

Alibaba Cloud OpenAPI Portal link: RegisterMedia.

Sample code:

import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.aliyuncs.DefaultAcsClient;
import com.aliyuncs.auth.AlibabaCloudCredentials;
import com.aliyuncs.auth.EnvironmentVariableCredentialsProvider;
import com.aliyuncs.exceptions.ClientException;
import com.aliyuncs.profile.DefaultProfile;
import com.aliyuncs.vod.model.v20170321.RegisterMediaRequest;
import com.aliyuncs.vod.model.v20170321.RegisterMediaResponse;

/**
 * Sample code for media asset registration
 *
 */
public class MediaRegisterDemo {

    /** 
     * Read the AccessKey information
     */
    public static DefaultAcsClient initVodClient() throws ClientException {
    // The region where ApsaraVideo VOD is activated.
    String regionId = "cn-shanghai";  
    // An AccessKey pair of an Alibaba Cloud account has permissions on all API operations. We recommend that you use a RAM user to call API operations or perform routine O&M.
    // We strongly recommend that you do not hard-code the AccessKey ID and AccessKey secret in your project code. Otherwise, the AccessKey pair may be leaked, which threatens the security of all your resources.
    // This example shows how to read the AccessKey pair from environment variables to authenticate API access. Before you run the sample code, configure the ALIBABA_CLOUD_ACCESS_KEY_ID and ALIBABA_CLOUD_ACCESS_KEY_SECRET environment variables.
    DefaultProfile profile = DefaultProfile.getProfile(regionId, System.getenv("ALIBABA_CLOUD_ACCESS_KEY_ID"), System.getenv("ALIBABA_CLOUD_ACCESS_KEY_SECRET"));
    DefaultAcsClient client = new DefaultAcsClient(profile);
    return client;
    }

    /**
     * Register media asset information
     * @param client The client that sends the request
     * @return RegisterMediaResponse The response data for registering media asset information
     * @throws Exception
     */
    public static RegisterMediaResponse registerMedia(DefaultAcsClient client) throws Exception {
        RegisterMediaRequest request = new RegisterMediaRequest();
        JSONArray metaDataArray = new JSONArray();
        JSONObject metaData = new JSONObject();
        // The title
        metaData.put("Title", "this is a sample");
        // The source file URL. The file name must be globally unique. If you add a file with the same name, it is associated with the unique media ID.
        metaData.put("FileURL", "https://192.168.0.0/16.oss-cn-shanghai.aliyuncs.com/vod_sample.mp4");
        // Specify the metadata of the media asset to register
        metaDataArray.add((metaData));
        request.setRegisterMetadatas(metaDataArray.toJSONString());
        return client.getAcsResponse(request);
    }

    /** 
     * Request example
     */
    public static void main(String[] argv)  {

        try {
            DefaultAcsClient client = initVodClient();
            RegisterMediaResponse response = registerMedia(client);
            if (response.getFailedFileURLs() != null && response.getFailedFileURLs().size() > 0) {
                for (String fileURL : response.getFailedFileURLs()) {
                    System.out.print("FailedFileURL = " + fileURL + "\n");
                }
            }
            if (response.getRegisteredMediaList() != null && response.getRegisteredMediaList().size() > 0) {
                for (RegisterMediaResponse.RegisteredMedia registeredMedia : response.getRegisteredMediaList()) {
                    System.out.print("MediaId = " + registeredMedia.getMediaId());
                    System.out.print("FileURL = " + registeredMedia.getFileURL());
                    System.out.print("NewRegister = " + registeredMedia.getNewRegister());
                    System.out.print("RequestId = " + response.getRequestId() + "\n");
                }
            }
        } catch (Exception e) {
            System.out.print("ErrorMessage = " + e.getLocalizedMessage());
        }

    }

}

Get URL upload information

Call the GetURLUploadInfos API to retrieve URL upload information.

Alibaba Cloud OpenAPI Portal link: GetURLUploadInfos.

Sample code:

import com.aliyuncs.DefaultAcsClient;
import com.aliyuncs.auth.AlibabaCloudCredentials;
import com.aliyuncs.auth.EnvironmentVariableCredentialsProvider;
import com.aliyuncs.exceptions.ClientException;
import com.aliyuncs.profile.DefaultProfile;
import com.aliyuncs.vod.model.v20170321.GetURLUploadInfosRequest;
import com.aliyuncs.vod.model.v20170321.GetURLUploadInfosResponse;
import org.apache.commons.lang3.StringUtils;

import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.List;

/**
 * Sample code for getting URL upload information
 */
public class URLUploadInfosGetDemo {
    
    /** 
     * Read the AccessKey information
     */
    public static DefaultAcsClient initVodClient() throws ClientException {
    // The region where ApsaraVideo VOD is activated.
    String regionId = "cn-shanghai";  
    // An AccessKey pair of an Alibaba Cloud account has permissions on all API operations. We recommend that you use a RAM user to call API operations or perform routine O&M.
    // We strongly recommend that you do not hard-code the AccessKey ID and AccessKey secret in your project code. Otherwise, the AccessKey pair may be leaked, which threatens the security of all your resources.
    // This example shows how to read the AccessKey pair from environment variables to authenticate API access. Before you run the sample code, configure the ALIBABA_CLOUD_ACCESS_KEY_ID and ALIBABA_CLOUD_ACCESS_KEY_SECRET environment variables.
    DefaultProfile profile = DefaultProfile.getProfile(regionId, System.getenv("ALIBABA_CLOUD_ACCESS_KEY_ID"), System.getenv("ALIBABA_CLOUD_ACCESS_KEY_SECRET"));
    DefaultAcsClient client = new DefaultAcsClient(profile);
    return client;
    }

    /**
     * Get URL upload information
     *
     * @param client The client that sends the request
     * @return GetURLUploadInfosResponse The response data for getting URL upload information
     * @throws Exception
     */
    public static GetURLUploadInfosResponse getURLUploadInfos(DefaultAcsClient client) throws Exception {
        GetURLUploadInfosRequest request = new GetURLUploadInfosRequest();

        // A list of source video URLs. The URLs must be URL-encoded.
        String[] urls = {
                "http://exampleBucket****.cn-shanghai.aliyuncs.com/video_01.mp4",
                "http://exampleBucket****.cn-shanghai.aliyuncs.com/video_02.flv"
        };
        List<String> encodeUrlList = new ArrayList<String>();
        for (String url : urls) {
            encodeUrlList.add(URLEncoder.encode(url, "UTF-8"));
        }
        request.setUploadURLs(StringUtils.join(encodeUrlList, ','));
        // A list of job IDs. You can obtain the job IDs from the PlayInfo struct returned by the GetPlayInfo API.
        //request.setJobIds("exampleID1,exampleID2");

        return client.getAcsResponse(request);
    }

    /** 
     * Request example
     */
    public static void main(String[] argv) {

        try {
            DefaultAcsClient client = initVodClient();
            GetURLUploadInfosResponse response = getURLUploadInfos(client);
            System.out.print("URLUploadInfoList = " + response.getURLUploadInfoList() + "\n");
            System.out.print("RequestId = " + response.getRequestId() + "\n");
        } catch (Exception e) {
            System.out.print("ErrorMessage = " + e.getLocalizedMessage());
        }
    }
}