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.
Sample code
Debug this operation online in the Alibaba Cloud OpenAPI Developer Portal.
<?php
require_once '../vendor/autoload.php';
use AlibabaCloud\SDK\ICE\V20201109\ICE;
use AlibabaCloud\SDK\ICE\V20201109\Models;
use AlibabaCloud\SDK\ICE\V20201109\Models\RefreshUploadMediaRequest;
use Darabonba\OpenApi\Models\Config;
try {
// An AccessKey of an Alibaba Cloud account has permissions to access all APIs. We recommend that you use a Resource Access Management (RAM) user to make API calls or perform routine O&M.
// This example shows how to store the AccessKey ID and AccessKey secret in environment variables. For more information about the configuration, see: https://help.aliyun.com/document_detail/311677.html.
$credential = new Credential([]);
$config = new Config([
'credential' => $credential,
'endpoint' => 'ice.cn-shanghai.aliyuncs.com'
]);
// To hard-code the AccessKey ID and AccessKey secret, use the following code. We strongly recommend that you do not store your AccessKey pair 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>';
$client = new ICE($config);
$request = new RefreshUploadMediaRequest();
$request->mediaId = "09c6aa40491c71ed9520472190a9xxxx";
$response = $client->refreshUploadMedia($request);
echo json_encode($response->body);
} catch (TeaUnableRetryError $e) {
var_dump($e->getMessage());
var_dump($e->getErrorInfo());
var_dump($e->getLastException());
var_dump($e->getLastRequest());
}
Related API operations
RefreshUploadMedia - Refresh a media asset upload credential
Is this page helpful?