Result Obtaining Interface Specification

1. Parameter specification

  • Request URL:

https://vsafe.ilivedata.com/api/v1/livevideo/check/result

  • Interface description:

The interface is used to obtain the results of live video detection, which include screenshot evidence, prohibited content and its classification. Having got the result with taskId, we won’t return to the statistics obtained before, when we call the database next time.

  • HTTP Request Headers:
Header Value Description
Content-Type application/json;charset=UTF-8 Request body type
Accept application/json;charset=UTF-8 Accepted return type
X-AppId The only identifier of the project or application
X-TimeStamp 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 Signature value
  • Request method:POST

  • Request body JSON object:

Parameter Necessity Type Description
taskId Essential String The taskId to which we return after calling successfully the video submission interface.
  • Example of request body:

    JSON response

      {
      "taskId": "f67fee0890de4c118d4f672b7c8ee304"
      }
    
  • Request signature

When the user requests the Video result API, the request can be signed with the appId and secretKey (obtained from the “Console - Service Configuration”). When the API receives the request with signature information, it will verify the signature using the same algorithm, and if the signature is found to be inconsistent, the API will return 401 error to the user.

  • Send signatures by HTTP Request Headers

Method: Add into the request a header whose name is Authorization and whose value is signature value, as follows:

 Authorization: Njl86M/jY6zZaZoGhZdGO+GI/8+yGFECusGH1yQHUFE=
  • Signature calculation method
  1. Canonicalized Query String:

Convert the request body JSON string to a hexadecimal string (not Base64) after 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” + HostHeaderInLowercase + “\n” + HTTPRequestURI + “\n” + CanonicalizedQueryString < obtain from the previous step > + “\n” + “X-AppId:” + SAME_APPID_IN_HEADER + “\n” + “X-TimeStamp:” + SAME_TIMESTAMP_IN_HEADER

The HTTPRequestURI is the absolute path to the request URI, not including the request string. If the HTTPRequestURI is empty, a forward slash (/) should still be kept.

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

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

    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

  • Example of signature

Below is an example of appId & secretKey & taskId.

appId=1000
secrectKey=d9e23d93053f49ade2f8fce185acedd4
taskId=f67fee0890de4c118d4f672b7c8ee304

Below is an example of a request body.

{
 "taskId": "f67fee0890de4c118d4f672b7c8ee304"
}

Generate CanonicalizedQueryString

b3ad8e9d16439ccd5e91924d2516bf9592975003f69beff44e56cddf47bd3118

Generate StringToSign

POST
vsafe.ilivedata.com
/api/v1/video/check/callback
b3ad8e9d16439ccd5e91924d2516bf9592975003f69beff44e56cddf47bd3118
X-AppId:1000
X-TimeStamp:2020-07-31T07:59:03Z

Signatures from HMAC calculations

H0ZXsKUaiRotpxSiXW6+RgKRwnxHXy3qwlVzavs9iHo=