Help Center > > API Reference> Moderation (Image)> Image Moderation (Asynchronous Batch)> Job Submission

Job Submission

Updated at: Mar 09, 2020 GMT+08:00

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).

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.

Table 1 Request parameters

Parameter

Mandatory

Type

Description

urls

Yes

Array

Indicates the URL of an image. The options are as follows:

  • HTTP/HTTPS URLs on the public network
  • HUAWEI CLOUD OBS URLs. To use OBS data, authorization is required, including service authorization, temporary authorization, and anonymous public authorization. For details, see Configuring the Access Permission of OBS.
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.

  • politics: checks whether political figures exist.
  • terrorism: checks whether any sensitive person involved in political affairs, terrorism-related content, or sensitive political information exists.
  • porn: checks whether pornographic elements exist.

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.

Response Message

Table 2 describes the response parameters.

Table 2 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 when the API fails to be called. For details, see Error Code.

This parameter is not included when the API is successfully called.

error_msg

String

Indicates the error message when the API fails to be called.

This parameter is not included when the API is successfully called.

Examples

  • Example request
    POST https://moderation.ap-southeast-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."
    }

Status Code

  • Normal

    200

  • 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.

Did you find this page helpful?

Submit successfully!

Thank you for your feedback. Your feedback helps make our documentation better.

Failed to submit the feedback. Please try again later.

Which of the following issues have you encountered?







Please complete at least one feedback item.

Content most length 200 character

Content is empty.

OK Cancel