Synchronization moderation interface

Request specification

  • Request URL:

Get it from the Console - Service Configuration

  • Interface description:

Submit the video information to the interface. After the information is submitted, screenshots of the video will be detected, and the results need to be obtained by calling the Result Obtaining Interface.

  • Supported Formats:

1.Audio package formats supported by the detection interface:wav、mp3、aac、amr、3gp、m4a、wma、ogg、ape etc

2.Audio duration needs to be less than 1 minute

  • HTTP Request Header:
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 Required Type Description
type Required Number 1:Audio URL 2: Audio BASE64 value
lang Required String language:Please Inquire the code at the bottom of the page
audio Required Srting Audio content, if type=1, then the value is the Audio URL, if type=2, then the value is Audio BASE64 value. When type is 2, then the Audio must be less than 10m.
strategyId Optional String Strategy number, use DEFAULT if no this param in request
userId Optional Srting Unique end user ID. The user ID should be no more than 32 characters.
userIP Optional Srting User IP address
did Optional Srting User device ID
dtype Optional Srting User device type:1:iPhone 2:android 3: ipad 4:wphone 5: pc 6:web 7:wap
  • Example of request body:

    JSON Response
    
        {
        "type":1,
        "lang":"zh-CN",
        "audio":"http://xxx.xxx.com/xxxx",
        "userId": "testUser"
        }  
    
  • Request signature:

When the user requests the Video Submit API, the request can be signed with the appId and secretKey (obtained from the Console - Service Configuration). When the API receives the request with the 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.

If the API validates the signature to be consistent and the user corresponding to the appId has permission to operate the requested resource, then the request succeeds, otherwise the API returns 401 error.

  • Send signatures by HTTP Request Headers

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

 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) 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” + HostHeaderInLowercase + “\n” + HTTPRequestURI + “\n” + CanonicalizedQueryString <obtained from previous step

                > + "\n" +
                "X-AppId:" + SAME_APPID_IN_HEADER + "\n" +
                "X-TimeStamp:" + SAME_TIMESTAMP_IN_HEADER
    

HTTPRequestURI is the absolute path to the request URI, not containing the CanonicalizedQueryString. If the HTTPRequestURI is empty, a forward slash (/) will be retained.

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

  1. StringToSign serves as the signature string, secretKey serves as the secret key and SHA256 serves 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

  • Example of signature

Below is an example of appId & secretKey & audio

appId=1000
secrectKey=d9e23d93053f49ade2f8fce185acedd4
audio_url="http://xxx.xxx.com/xxxx"

Below is an example of request body.

{
 "type": 1,
 "audio":"http://xxx.xxx.com/xxxx",
 "userId": "12345678"
}

Generate CanonicalizedQueryString

b3ad8e9d16439ccd5e91924d2516bf9592975003f69beff44e56cddf47bd3118

Generate StringToSign

 POST
 asafe.ilivedata.com
 /api/v1/audio/check/submit
 b3ad8e9d16439ccd5e91924d2516bf9592975003f69beff44e56cddf47bd3118
 X-AppId:1000
 X-TimeStamp:2020-07-31T07:59:03Z

Signatures from HMAC calculations

H0ZXsKUaiRotpxSiXW6+RgKRwnxHXy3qwlVzavs9iHo=

HTTP Response

Content-Type: application/json;charset=UTF-8 The result is in the JSON format, please refer to the following example.

HTTP response: Description of returning json fields

Field Name Type Description
errorCode Number Error code:0 means success
errorMessage String Error message
code Number Status code, defined as: 0: successful detection, 1: image download failed, 2: image format error, 3: other
taskId String TaskId assigned by the system
result Number 0: Pass, 1: Recommended for review, 2: Fail
audioSpams json array Hit information

audioSpams:

Field Name Type Description
startTime Number The start time of the hit audio segment, in seconds
endTime Number The end time of the hit audio segment, in seconds
vpr Boolean Hit voiceprint detection
score double vpr score
tags json数组 Classified information

tags:

Field name Type Description
tag Number Classified information:
100: politics, 110: violence, 120: prohibited, 130: eroticism, 150: advertisement, 160: insults,
170: Hate speech, 180: Minor protection, 190: sensitive hot spots,
220:private transaction,900: other, 999: customization
tagName String Detect first-level type names
tagNameEn String Detect first-level type names (English)
level json object Classification level, 0: normal, 1: suspected, 2: abnormal
startTime Number The start time of the hit audio segment, in seconds
endTime Number The end time of the hit audio segment, in seconds
subTags json array details

subTags:

Field name Type Description
subTag Number Secondary classification information reference Classification Code
subTagName String Detect secondary type names
subTagNameEn String Detect secondary type names (English)
wordList array of strings hit details
  • Response example:

    JSON response

      {
          "errorCode": 0,
          "code": 0,
          "result": 2,
          "taskId": "nx_10e04ba8-367d-462e-b7a0-437a12acbba1_1616666938669",
          "audioSpams": [{
              "startTime":18.0,
              "endTime":20.0,
              "text": "开始了应该是皮耶罗强调,在辛贾尔袭击事件发生两年后的今天,伊斯兰国组织旨在摧毁野心的人,社区的灭绝种族等犯罪暴行仍在持续进行曲调查,目前有大约3200名耶西的妇女和儿童被伊斯兰国组织腐乳企业遭受令人难以想象的虐待在叙利亚伊斯兰国,战斗人员继续将妇女和女童作为性奴隶随意贩卖和当作赠品",
              "tags": [{
                  "tag": 130,
                  "level": 2,
                  "subTags": [{
                      "subTag": 130001,
                      "wordList": [
                          "性奴"
                      ]
                  }]
              }]
          }],
          "language":"zh-CN"
      }
    

Error code

Http Status code Error code Error message
200 0 This field is omitted
405 1004 Method Not Allowed
411 1007 Not Content Length
400 1002 API Not Found
400 1003 Bad Request
401 1102 Unauthorized Client
401 1106 Missing Access Token
401 1107 Invalid Token
401 1108 Expired Token
401 1110 Invalid Client
400 2000 Missing Parameter
400 2001 Invalid Parameter