Obtain URL upload information

Updated at:

This topic provides sample code that shows how to use the server-side SDK to call an OpenAPI operation to obtain URL upload information.

Usage notes

To configure environment variables, see Configure environment variables in Linux, macOS, and Windows.

Sample code

To debug this operation online, use the Alibaba Cloud OpenAPI Developer Portal.

package com.aliyun.ice.sample;

import com.aliyun.ice20201109.Client;
import com.aliyun.ice20201109.models.*;
import com.aliyun.teaopenapi.models.Config;

public class Sample {

    public static void main(String[] args) throws Exception {

        // An AccessKey of an Alibaba Cloud account has full access permissions to all APIs. Use a Resource Access Management (RAM) user to call APIs or perform routine O&M.
        // This example shows how to store the AccessKey ID and AccessKey secret in environment variables. For more information, see https://help.aliyun.com/document_detail/378657.html
        com.aliyun.credentials.Client credentialClient = new com.aliyun.credentials.Client();
        Config config = new Config();
        config.setCredential(credentialClient);

        // To hard-code the AccessKey ID and AccessKey secret, use the following code. However, do not hard-code the AccessKey ID and AccessKey secret in your project code. This can lead to an AccessKey leak and compromise the security of all resources in your account.
        // config.accessKeyId = <yourAccessKeyId>;
        // config.accessKeySecret = <yourAccessKeySecret>;

        config.endpoint = "ice.cn-shanghai.aliyuncs.com";
        Client client = new Client(config);
        GetUrlUploadInfosRequest request = new GetUrlUploadInfosRequest()
            .setUploadURLs("https://test.com/test.mp4");
        GetUrlUploadInfosResponse response = client.getUrlUploadInfos(request);
        System.out.println("GetUrlUploadInfo: " + response.getBody().getURLUploadInfoList());
    }
}          

Related API operation

GetUrlUploadInfos - Obtain URL upload information