Get appKey and appSecrt

Get application access_token

[Please note] Under normal circumstances, the validity period of access_token is 7200 seconds. Repeated acquisition is accessible within the validity period, which brings back the same result and the validity period canbe automatically renewed.

Request method:GET(HTTPS)

Interface Name

/gettoken.json

Request parameter

Parameter Parameter Type Required Remark
appkey String Yes Unique identifier “key”
appsecret String Yes App Password

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);

Return parameter

Parameter Remarks
accessToken Apply access_token
expiresIn Expiration time, unit (seconds)

Return Result

  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. }

Frequent mistakes

Frequently reported errors of the Interface

OPF-B001-05-16-0009 SignatureDoesNotMatch

Please confirm whether the “appsecret” and the domain name configuration are correct, and whether the appkey matches the appsecret