This topic describes the /green/webpage/asyncscan operation that you can call to asynchronously moderate web pages. Web page moderation helps you detect image and text violations on a web page, and returns moderation results and the categories of moderation results. You can call this operation to moderate web pages that use HTTP or HTTPS URLs.
Description about the /green/webpage/asyncscan operation
Operation: /green/webpage/asyncscan
You can call this operation to submit asynchronous web page moderation tasks. For more information about how to construct an HTTP request, see Request structure. You can also select an existing HTTP request. For more information, see SDK overview.
- Billing method:
You are charged for calling this operation. For more information about the billing method, seeContent Moderation Pricing.
- Return results:
If you send asynchronous moderation requests, the moderation results are not returned in real time. To obtain moderation results, you can poll the moderation results at regular intervals or enable callback notification. The moderation results are retained for up to 1 hour.
- Enable callback notification to obtain moderation results: When you submit asynchronous moderation tasks, you can specify a callback URL for receiving moderation results in the callback parameter of the moderation request. For more information, see the request parameters of asynchronous web page moderation.
- Poll moderation results: You do not need to set the callback parameter when you submit asynchronous moderation tasks. After you submit the tasks, you can call the result query operation to query moderation results. For more information, see Query asynchronous web page moderation results.
Request parameters
Parameter | Type | Required | Example | Description |
---|---|---|---|---|
bizType | String | No | default | The business scenario. You can create a business scenario in the Alibaba Cloud Content Moderation console. For more information, see Customize policies for machine-assisted moderation. You can also submit a ticket to ask Alibaba Cloud engineers to help you create a business scenario. |
callback | String | No | http://xxx.xx.xx/xx.json | The callback URL for notifying you of asynchronous moderation results. HTTP and HTTPS
URLs are supported. If you do not set this parameter, you must poll moderation results
at regular intervals.
If you set the callback parameter in the moderation request, make sure that the specified
HTTP or HTTPS URL meets the following requirements: supports the POST method, uses
UTF-8 to encode the transmitted data, and supports the checksum and content parameters. To send moderation results to the specified callback URL, Content Moderation
returns the checksum and content parameters in callback notifications based on the following rules and format:
Note If your server receives a callback notification, the server sends HTTP status code
200 to Content Moderation. If your server fails to receive a callback notification,
the server sends other HTTP status codes to Content Moderation. If your server fails
to receive a callback notification, Content Moderation continues to push the callback
notification until your server receives it. Content Moderation can push a callback
notification repeatedly for up to 16 times. After 16 times, Content Moderation stops
pushing the callback notification. In this case, we recommend that you check the status
of the callback URL.
|
seed | String | No | aabbcc123 | A random string that is used to generate a signature for the callback notification
request.
The string can be up to 64 characters in length and can contain letters, digits, and underscores (_). You can customize this string. It is used to verify the callback notification request when Alibaba Cloud Content Moderation pushes callback notifications to your server. Note This parameter is required if you set the callback parameter.
|
textScenes | Array | No | ["antispam"] | The moderation scenario of the text to be moderated on a web page. Set the value to
antispam.
Note You must specify at least one of the textScenes and imageScenes parameters.
|
imageScenes | Array | No | ["porn","terrorism"] | The moderation scenario of the images to be moderated on a web page. Valid values:
Note You must specify at least one of the textScenes and imageScenes parameters.
|
tasks | JSONArray | Yes | The list of moderation tasks. The value is a JSON array that can contain one or more elements. Each element in the JSON array is a structure. The JSON array can contain up to five elements. For more information about the structure of each element, see task. | |
returnHighlightHtml | Boolean | No | false | Specifies whether to highlight violations. Valid values:
|
Parameter | Type | Required | Example | Description |
---|---|---|---|---|
dataId | String | No | test4lNSMdggA0c56MMvfYoh4e-1mwxpx | The ID of the moderation object.
The ID can contain letters, digits, underscores (_), hyphens (-), and periods (.) and can be up to 128 characters in length. This ID uniquely identifies your business data. |
url | String | No | http://www.test.html | The URL of the web page. You can moderate web pages that use HTTP or HTTPS URLs.
Note You must specify one of the url and content parameters.
|
content | String | No | <html>hello,world! </html> | The plaintext in the HTML format of the web page.
Note You must specify one of the url and content parameters.
|
Response parameters
Parameter | Type | Example | Description |
---|---|---|---|
code | Integer | 200 | The returned HTTP status code.
For more information, see Common response parameters. |
msg | String | OK | The message that is returned for the request. |
dataId | String | test4lNSMdggA0c56MMvfYoh4e-1mwxpx | The ID of the moderation object.
Note If you set the dataId parameter in the moderation request, the dataId parameter is returned in the response.
|
taskId | String | wp5$7n$hD74qu4CrNWZlR7Sr-1ttC3T | The list of IDs of asynchronous moderation tasks that you want to query. The array can contain up to 100 elements. |
url | String | http://test.html | The URL of the moderation object. |
Examples
Sample requests
{
"textScenes": [
"antispam"
],
"imageScenes": [
"porn"
],
"tasks": [
{
"dataId": "test4lNSMdggA0c56MMvfYoh4e-1mwxpx",
"url": "http://test.html"
}
]
}
{
"code": 200,
"msg": "OK",
"requestId": "95AD868A-F5D2-4AEA-96D4-E0273B8E074C",
"data": [
{
"code": 200,
"msg": "OK",
"dataId": "test4lNSMdggA0c56MMvfYoh4e-1mwxpx",
"taskId": "wp5$7n$hD74qu4CrNWZlR7Sr-1ttC3T",
"url": "http://test.html"
}
]
}