刷新媒资上传凭证

更新时间:2024-11-01 03:24:53

通过阅读本文,您可以了解通过服务端SDK调用OpenAPI刷新媒资上传凭证的示例代码。

使用说明

配置环境变量的具体操作,请参见Linux、macOSWindows系统配置环境变量

示例代码

您可以通过阿里云OpenAPI开发者门户在线调试。

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 {

        // 阿里云账号AccessKey拥有所有API的访问权限,建议您使用RAM用户进行API访问或日常运维。
        // 本示例以将AccessKey ID和 AccessKey Secret保存在环境变量为例说明。配置方法请参见: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);

        // 如需硬编码AccessKey ID和AccessKey Secret,代码如下,但强烈建议不要把AccessKey ID和AccessKey Secret保存到工程代码里,否则可能导致AccessKey泄露,威胁您账号下所有资源的安全。
        // 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());
    }
}

相关接口

RefreshUploadMedia - 刷新媒资上传凭证

  • 本页导读 (1)
  • 使用说明
  • 示例代码
  • 相关接口
AI助理

点击开启售前

在线咨询服务

你好,我是AI助理

可以解答问题、推荐解决方案等