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):
ExecutableClient executableClient =ExecutableClient.getInstance();
executableClient.setAccessKey("appkey");
executableClient.setSecretKey("appsecrt");
executableClient.setDomainName("不同环境对应不同域名");
executableClient.setProtocal("https");
executableClient.init();
//executableClient要单例,并且使用前要初始化,只需要初始化一次
String api = "/gettoken.json";
GetClient getClient = executableClient.newGetClient(api);
//设置参数
getClient.addParameter("appkey", "37affba10137489c9cc8812b6b19590000003501");
getClient.addParameter("appsecret", "37affba10137489c9cc8812b6b19590000003501");
//调用API
String apiResult = getClient.get();
System.out.println(apiResult);
Return parameter
Parameter | Remarks |
---|---|
accessToken | Apply access_token |
expiresIn | Expiration time, unit (seconds) |
Return Result
{
"success":true,
"content":{
"data":{
"accessToken":"c139fe44362f41b6b84862ec82ab84d9",
"expiresIn":"7200"
},
"requestId":"df04428415724925400701038d663a",
"responseMessage":"OK",
"responseCode":"0",
"success": true
}
}
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