Parameter Specification

一、 Parameter specification

  • Callback URL:

Fill in the “Console - Service Configuration - Manual Annotation - Callback URL”.

  • HTTP request Header:
Header Value Required Descriptio
Content-Type application/json;charset=UTF-8 Required Request body type
Accept application/json;charset=UTF-8 Required Return type accepted
X-AppId Required The only identifier of the project or application.
X-TimeStamp Required The UTC timestamp of the request. Timestamps need to be formatted according to W3C standards, for example: 2010-01-31T23:59:59Z. (http://www.w3.org/TR/xmlschema-2/#dateTime).
Authorization Required Signature value
  • Request method:POST

  • Request body JSON object:

Parameter Required Type Description
appId Required String Project Number
textData Required Array Original Data
markData Required Array Modify Data
  • Example of request body:
  {
    "appId": "",
    "textData": [
      {
        "taskId": "",
        "strategyId": "",
        "language": "",
        "stext": "",
        "word": "",
        "userId": "",
        "result": "",
        "tag": "",
        "subTag": "",
      }
    ],
    "markData": {
      "markResult": "",
      "markTag": "",
    }
  }     
  • Request Header to send a signature via HTTP

Method: Add a header named Authorization in the request, whose value is the signature value. For example:

 Authorization: ****
  • Signature calculation method
  1. Canonicalized Query String:

Convert the request body JSON string to a hexadecimal string (not Base64) by doing sha256 encoding with UTF-8 character encoding.

CanonicalizedQueryString = hex(sha256(jsonBody))

  1. Constructs the signed string StringToSign ("\n" stands for ASCII newline character):
  StringToSign = HTTPMethod + "\n" +
                  CallbackUrl + "\n" +
                  CanonicalizedQueryString <get from previous> + "\n" +
                  "X-AppId:" + SAME_APPID_IN_HEADER + "\n" +
                  "X-TimeStamp:" + SAME_TIMESTAMP_IN_HEADER

HTTPMethod: POST

CallbackUrl: This value in the < Console - Service Configuration - Manual Annotation - Callback URL >.

The hash-based message authentication code (HMAC) is created using the HMAC-SHA256 protocol and the signature is calculated.

  1. StringToSign as the signature string, secretKey as the secret key and SHA256 as the hash algorithm.

    For more information about HMAC, see: https://tools.ietf.org/html/rfc2104.
    
  2. Converting the results of the previous step to a BASE64 string

  3. Put the BASE64 string into the Authorization of HTTP request Header