1. 签名说明

openapi默认提供java版sdk,使用sdk无需关注签名,如果使用其他语言请主动签名

接口和语言无关,符合签名规范即可调用

1.1. 接口地址

1.2. 签名

1.3. 参数说明

  • header
    • Content-Type:固定值:application/json
    • Access-Key-Id:拿到授权的秘钥id
    • Open-Id:主动获取的openid
    • X-Amz-Date:请求时间,格式为:yyyyMMdd'T'HHmmss'Z'
    • host:固定值:api.77hub.com
  • body
    • 说明:对象标准接口body为固定格式的json数据,非标准接口参数请查看开放平台文档
    • 格式:{"json":"接口参数"},其中接口参数格式为文档 接入流程中的参数示例的json字符串
    • 示例(add接口参数)
      {"json":"{\"objectType\":\"Customer\",\"data\":{\"code\":\"New0011584708918555\",\"externalObjectId\":\"1001\",\"externalObjectType\":\"Customer\",\"externalSystemCode\":\"77hub\",\"name\":\"test\"}}"}
      

1.4. 请求示例

  • AwsSignUtils在sdk的包路径:com.q7link.openapi.utils.AwsSignUtils
  • java请求(代码仅做为参考)
    public static void main(String[] args)throws Exception {
      String accessKeyId = "your accessKeyId";
      String secretAccessKey = "your secretAccessKey";
      String host = "https://api2.77hub.com";
      String path = "/v1/add";
      long timestamp = System.currentTimeMillis();
      String method = "POST";
      Map<String, String> headers = new HashMap<>();
      headers.put("Content-Type", "application/json");
      headers.put("Access-Key-Id", accessKeyId);
      headers.put("Open-Id", "your openid");
      headers.put("X-Amz-Date", AwsSignUtils.DATE_FORMAT_ISO.format(timestamp)); // yyyyMMdd'T'HHmmss'Z'
      headers.put("host", host.replace("https://", "").replace("http://", ""));
      Map<String, String> body = Collections.singletonMap("json", "{\"objectType\":\"Customer\",\"data\":{\"code\":\"New0011584708918555\",\"externalObjectId\":\"1001\",\"externalObjectType\":\"Customer\",\"externalSystemCode\":\"77hub\",\"name\":\"test\"}}");
      Map<String, String> signForHeader = AwsSignUtils.geneSignForHeader(accessKeyId, secretAccessKey, timestamp, method, path, null, headers, body);
      headers.putAll(signForHeader);
      Pair<Integer, String> request = HttpClientUtils.request(method, host + path, headers, body);
    }
    

results matching ""

    No results matching ""