Job Submission
Function
This API submits a batch of image moderation jobs, and returns the job IDs used for querying the results. It is an asynchronous API. Compared with the batch API, this API supports a larger batch.
Prerequisites
- Before using Text Moderation, you need to apply for the service and complete authentication. For details, see Getting Started with Moderation (Image).
- By default, the maximum number of concurrent API calls is 10. To increase concurrency, contact Huawei technical support.
URI
URI format
POST /v1.0/moderation/image/batch/jobs
Request Message
Table 1 describes the request parameters. Each user can keep a maximum number of 20 uncompleted jobs.
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| urls | Yes | Array | Indicates the URL of an image. The options are as follows:
NOTE: You can configure a maximum of 500 URLs. The API response time depends on the image download time. If the image download takes a long time, the API call will fail. Ensure that the storage service where the image to be detected resides is stable and reliable. You are advised to use HUAWEI CLOUD OBS. |
| categories | No | Array | Indicates the detection scenario.
You can set the parameter to the preceding values to check the corresponding elements. If this parameter is left blank or does not exist, both politics and terrorism scenarios are checked, but the porn scenario is not included. |
| threshold | No | Number | For details, see the threshold parameter description. |
Response Message
Table 2 describes the response parameters.
| Parameter | Type | Description |
|---|---|---|
| result | Object | Indicates the calling result when the API is successfully called. This parameter is not included when the API fails to be called. |
| job_id | String | Indicates the IDs of a batch of video moderation jobs, which are used for result query. |
| error_code | String | Indicates the error code of a failed API call. For details, see Error Codes. This parameter is not included when the API is successfully called. |
| error_msg | String | Indicates the error message of a failed API call. This parameter is not included when the API is successfully called. |
Examples
- Example request
POST https://moderation.cn-north-1.myhuaweicloud.com/v1.0/moderation/image/batch/jobs Request Header: Content-Type:application/json X-Auth-Token: MIINRwYJKoZIhvcNAQcCoIINODCCDTQCAQExDTALBglghkgBZQMEAgEwgguVBgkqhkiG... Request Body: { "urls": ["https://BucketName.obs.myhuaweicloud.com/ObjectName", "https://BucketName.obs.myhuaweicloud.com/ObjectName1"], "categories": [ "politics", "terrorism", "porn" ] }
- Example successful response
{ "result": { "job_id": "44d93b70-db01-4f96-a618-2a79c964c4b2" } } - Example failed response
{ "error_code": "AIS.0005", "error_msg": "The service does not exist." }
- Abnormal
Return Value
Description
400
- The request cannot be understood by the server due to malformed syntax. The client should not repeat the request without modifications.
- The request parameter is incorrect.
401
The request requires user authentication.
403
No operation permission.
404
The server has not found anything matching the Request-URI.
500
The server encountered an unexpected condition which prevented it from fulfilling the request.
Last Article: Image Moderation (Asynchronous Batch)
Next Article: Result Query
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.