Refresh a media asset upload credential

更新时间:
复制 MD 格式

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

Sample code

Debug this operation online in the Alibaba Cloud OpenAPI Developer Portal.

import OpenApi, * as $OpenApi from '@alicloud/openapi-client';
import Credential, { Config } from '@alicloud/credentials';
const Client = require('@alicloud/ice20201109').default;

// An AccessKey for an Alibaba Cloud account grants full access to all APIs. Use a Resource Access Management (RAM) user for API calls or routine O&M.
// In this example, the AccessKey ID and AccessKey secret are stored as environment variables. For more information about how to configure environment variables, see https://help.aliyun.com/document_detail/378664.html

const cred = new Credential();
const iceClient = new Client(new $OpenApi.Config({
  credential: cred,
  endpoint: 'ice.cn-shanghai.aliyuncs.com'
}));

// To hard-code your AccessKey ID and AccessKey secret, use the following code. Do not store the AccessKey ID and AccessKey secret in your project code. This practice can cause an AccessKey leak and compromise the security of all resources in your account.
// const iceClient = new Client(new $OpenApi.Config({
//   accessKeyId: '<yourAccessKeyId>',
//   accessKeySecret: '<yourAccessKeySecret>',
//   endpoint: 'ice.cn-shanghai.aliyuncs.com'
// }));

// Refresh the upload credential.
iceClient.refreshUploadMedia({
    mediaId: "6e9082b0507a71ed992190959850****"
}).then(function (data) {
    console.log(data.body);
}, function (err) {
    console.log('Error:' + err);
});

Related API operations

RefreshUploadMedia - Refresh a media asset upload credential