Common request parameters consist of common request header parameters and common query parameters.

Common request header parameters

The following table lists the common request header parameters that are included in all HTTP requests.
Parameter Type Required Description
Accept String Yes The data type of the response. Currently, only the application/json type is supported.
Content-Type String Yes The data type of the request body. Currently, only the application/json type is supported.
Content-MD5 String Yes The value computed based on the request body. To obtain the hash value, apply the MD5 algorithm on the request body to obtain an output of binary data and then encode the output according to the Base64 algorithm.
Date String Yes The GMT date. Example: Tue, 17 Jan 2017 10:16:36 GMT.
x-acs-version String Yes The version of the Content Moderation API. The current version is 2018-05-09.
x-acs-signature-nonce String Yes A random string used to defend against replay attacks.
x-acs-signature-version String Yes The version of the signature. The current version is 1.0.
x-acs-signature-method String Yes The method used to sign signatures. Currently, only HMAC-SHA1 is supported.
Authorization String Yes The authentication method, which is in the format of "acs" + " " + AccessKeyId + ":" + signature.

In the format, AccessKeyId can be obtained from the Alibaba Cloud console and signature is the request signature. For more information about the signature algorithm, see Signature method.

Common query parameters

The following table lists the common query parameters included in all HTTP requests.
Parameter Type Required Description
clientInfo String No The client information, which is serialized from the ClientInfo structure in JSON format. It contains UMID and IMEI. For more information about the structure, see ClientInfo.
Table 1. ClientInfo
Parameter Type Required Description
sdkVersion String No The version of the SDK. This parameter is required when an operation is called through the SDK.
cfgVersion String No The version of the configuration. This parameter is required when an operation is called through the SDK.
userType String No The type of the user account. Valid values:
  • taobao
  • others
userId String No The unique ID of the user.
userNick String No The nickname of the user.
avatar String No The avatar of the user.
imei String No The code of the hardware device.
imsi String No The code of the operator's device.
umid String No The unique material identifier (UMID) of the device.
ip String No The public network IP address. If this parameter is not specified in a request, the server attempts to obtain the IP address from the link or the HTTP request header. If the request is initiated from the device side, this parameter is usually left blank. If the request is initiated from the server side, this IP address is the user's logon IP address or the public network IP address of the device.
os String No The operating system of the device. Example: Android 6.0.
channel String No The channel number.
hostAppName String No The name of the host application.
hostPackage String No The name of the host application package.
hostVersion String No The version of the host application.

Sample requests

POST /green/image/scan? clientInfo=%7b%22userId%22%3a%22120234234%22%2c%22userNick%22%3a%22Mike%22%2c%22userType%22%3a%22others%22%7d HTTP/1.1
Accept: application/json
Content-Type: application/json
Content-MD5: C+5Y0crpO4sYgC2DNjycug==
Date: Tue, 15 May 2018 10:16:36 GMT
x-acs-version: 2018-05-09
x-acs-signature-nonce: adfkjfaHKslkjf
x-acs-signature-version: 1.0
x-acs-signature-method: HMAC-SHA1
Authorization: acs q23Q9K4PaGi12Wyk:adFff0FFO6sGcDbDNjRtso==
Host: green.cn-shanghai.aliyuncs.com/
Content-Length: 191
{
"scenes": ["porn"],
"tasks": [
{
"dataId": "test2NInmO$tAON6qYUrtCRgLo-1mwxdi",
"url": "https://img.alicdn.com/tfs/TB1urBOQFXXXXbMXFXXXXXXXXXX-1442-257.png"
}
]
}
Where,
  • POST specifies the request method.
  • /green/image/scan is the request path.
  • clientInfo=%7b%22userId%22%3a%22120234234%22%2c%22userNick%22%3a%22Mike%22%2c%22userType%22%3a%22others%22%7d is the common query parameter after encoding.
  • The subsequent parameters are the HTTP header parameters. The part between Accept and Authorization is the common request header used for signature.
  • The content enclosed in braces ({ }) is the JSON-formatted request body.