跳转至

查看可调用次数

最后更新:2022年03月31日

接口能力

本接口用于查询AMSU健康云API的可调用次数,如需获得调用权限,请与AMSU取得联系。

请求方法

HTTP方法: GET
请求URL:http://api.amsu-new.com/amsu-analysis/v2/available-times
Header参数:

字段 类型 描述
Authorization Bearer Token 构造方式为Bearer+(空格)+(Access Token)

返回参数

字段 类型 描述
arrhythmia_analysis Integer 「疑似心律异常分析」系列接口可调用次数,-1表示无次数限制
hrv_analysis Integer 「HRV分析」系列接口可调用次数,-1表示无次数限制
health_analysis Integer 「健康状况评估」系列接口可调用次数,-1表示无次数限制
calorie_analysis Integer 「精准卡路里计算」系列接口可调用次数,-1表示无次数限制

正确返回示例:

HTTP状态码:200

{
    "arrhythmia_analysis": 9613,
    "hrv_analysis": 4970,
    "health_analysis": 2324,
    "calorie_analysis": 6024,
}

错误返回示例:

HTTP状态码不为200

{
    "error": {
        "code": "COMMON.INVALID_CREDENTIALS",
        "msg": "Invalid authentication credentials."
    }
}

错误码

参见 公共错误码

示例代码

OkHttpClient client = new OkHttpClient().newBuilder().build();
Request request = new Request.Builder()
  .url("http://api.amsu-new.com/amsu-analysis/v2/available-times")
  .method("GET", null)
  .addHeader("Authorization", "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJhcHBfa2V5OjkzZWUyMGNiNTliOTY0OWY3YzIwIiwiZXhwIjoxNjQ4NDY4MDExfQ.gx4orCBaEMFppU99WguP5ar6L99cs1Rvexh4vgGEcUU")
  .build();
Response response = client.newCall(request).execute();
#import <Foundation/Foundation.h>

dispatch_semaphore_t sema = dispatch_semaphore_create(0);

NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"http://api.amsu-new.com/amsu-analysis/v2/available-times"]
  cachePolicy:NSURLRequestUseProtocolCachePolicy
  timeoutInterval:10.0];
NSDictionary *headers = @{
  @"Authorization": @"Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJhcHBfa2V5OjkzZWUyMGNiNTliOTY0OWY3YzIwIiwiZXhwIjoxNjQ4NDY4MDExfQ.gx4orCBaEMFppU99WguP5ar6L99cs1Rvexh4vgGEcUU"
};

[request setAllHTTPHeaderFields:headers];
NSData *postData = [[NSData alloc] initWithData:[@"" dataUsingEncoding:NSUTF8StringEncoding]];
[request setHTTPBody:postData];

[request setHTTPMethod:@"GET"];

NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
  if (error) {
    NSLog(@"%@", error);
    dispatch_semaphore_signal(sema);
  } else {
    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
    NSError *parseError = nil;
    NSDictionary *responseDictionary = [NSJSONSerialization JSONObjectWithData:data options:0 error:&parseError];
    NSLog(@"%@",responseDictionary);
    dispatch_semaphore_signal(sema);
  }
}];
[dataTask resume];
dispatch_semaphore_wait(sema, DISPATCH_TIME_FOREVER);
var myHeaders = new Headers();
myHeaders.append("Authorization", "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJhcHBfa2V5OjkzZWUyMGNiNTliOTY0OWY3YzIwIiwiZXhwIjoxNjQ4NDY4MDExfQ.gx4orCBaEMFppU99WguP5ar6L99cs1Rvexh4vgGEcUU");

var requestOptions = {
  method: 'GET',
  headers: myHeaders,
  redirect: 'follow'
};

fetch("http://api.amsu-new.com/amsu-analysis/v2/available-times", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));
import requests

url = "http://api.amsu-new.com/amsu-analysis/v2/available-times"

payload={}
headers = {
  'Authorization': 'Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJhcHBfa2V5OjkzZWUyMGNiNTliOTY0OWY3YzIwIiwiZXhwIjoxNjQ4NDY4MDExfQ.gx4orCBaEMFppU99WguP5ar6L99cs1Rvexh4vgGEcUU'
}

response = requests.request("GET", url, headers=headers, data=payload)

print(response.text)