Refresh a media asset upload credential

Updated at:

You can call the RefreshUploadMedia operation by using a server SDK to refresh a media asset upload credential.

Usage notes

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

Sample code

You can debug this operation online in 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 {

        // The AccessKey pair of an Alibaba Cloud account has permissions to call all API operations. We recommend that you use the AccessKey pair of a RAM user to call API operations or perform routine O&M.
        // In this example, the AccessKey ID and the AccessKey secret are obtained from the 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 your AccessKey ID and AccessKey secret, use the following code. However, we recommend that you do not save the AccessKey ID and the AccessKey secret in your project code. Otherwise, the AccessKey pair may be leaked and the security of resources within your account may be compromised.
        // config.accessKeyId = <yourAccessKeyId>;
        // config.accessKeySecret = <yourAccessKeySecret>;

        config.endpoint = "ice.cn-shanghai.aliyuncs.com";
        Client client = new Client(config);
        RefreshUploadMediaRequest request = new RefreshUploadMediaRequest()
            .setMediaId("09c6aa40491c71ed9520472190a9xxxx");
        RefreshUploadMediaResponse response = client.refreshUploadMedia(request);
        System.out.println("RefreshUploadMedia upload address: " + response.getBody().getUploadAddress());
    }
}

Related API operations

RefreshUploadMedia - Refresh a media asset upload credential