The image with return results of “mediaId” needs to be displayedwith the About Encrypted Image Display - 图1 tag, and here’s the following method:

Download interface with file to get the file content, and the spliced URL can be used directly in the label

  1. <img src="https://openplatform-xxxx.com/media/download?access_token=app_52890e21fbdd408894912802b78095c5&media_id=$iwHSAADx6woAC9IAAOlzAqNqcGcDBgTRAtAF0QYYBrBuEhqOrAsA2sBFsQKLqzIdBwAIAAmiaW0 " />

Please note: This address is temporarybecause it cannot be accessed after the validity period of “access_token” expired.

Get image address

Interface name

/media/download

Interface address

GET https://开放平台网关域名/media/download?access_token=ACCESS_TOKEN&media_id=xxxx

参数说明

Parameter Whether it’s required to fill in Remark
access_token Yes The appToken required to access the gateway
media_id Yes The mediaId returned by the service after the upload is complete

Back Remark

Go back to the file stream. Please note: this interface is only used to get the content of the file, and it does not contain the original name of the file

Note: You need to subscribe to /media/download service of gateway first to use this interface. Service type: file storage

Getting application “access_token”

Interface name

/gettoken.json

Interface address

GET https://开放平台网关域名/gettoken.json

Parameter description

Parameter Parameter Type Must Remark
appkey String Yes App ak
appsecret String Yes App ak

SDK request example (JAVA):

  1. ExecutableClient executableClient =ExecutableClient.getInstance();
  2. executableClient.setAccessKey("appkey");
  3. executableClient.setSecretKey("appsecrt");
  4. executableClient.setDomainName("不同环境对应不同域名");
  5. executableClient.setProtocal("https");
  6. executableClient.init();
  7. //executableClient要单例,并且使用前要初始化,只需要初始化一次
  8. String api = "/gettoken.json";
  9. GetClient getClient = executableClient.newGetClient(api);
  10. //设置参数
  11. getClient.addParameter("appkey", "37affba10137489c9cc8812b6b19590000003501");
  12. getClient.addParameter("appsecret", "37affba10137489c9cc8812b6b19590000003501");
  13. //调用API
  14. String apiResult = getClient.get();
  15. System.out.println(apiResult);

Back remark

Parameter Remark
accessToken App access_token
expiresIn expiration time, unit (seconds)
  1. {
  2. "success":true,
  3. "content":{
  4. "data":{
  5. "accessToken":"c139fe44362f41b6b84862ec82ab84d9",
  6. "expiresIn":"7200"
  7. },
  8. "requestId":"df04428415724925400701038d663a",
  9. "responseMessage":"OK",
  10. "responseCode":"0",
  11. "success": true
  12. }
  13. }