Help Center > > API Reference> Moderation (Image)> Image Moderation (Asynchronous Batch)> Result Query

Result Query

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

Function

This API queries the result of a batch image moderation job. If the batch job is executed successfully, the detailed moderation result of each image is returned. The batch job will not fail upon the failure of a single image.

The jobs will be stored on the cloud for a maximum of 30 minutes. You are advised to perform a periodic query every 30 seconds after the batch job is submitted.

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

GET /v1.0/moderation/image/batch?job_id={job_id}

Request Message

Table 1 describes the request parameters.

Table 1 Request parameters

Parameter

Mandatory

Type

Description

job_id

Yes

String

Indicates the job ID.

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 job ID.

status

String

Indicates the job status. Possible values are as follows:

created: indicates that a job is created.

running: indicates that a job is being processed.

finish: indicates that a job is completed.

failed: indicates that a job fails to be processed.

create_time

String

Indicates the time when a job is created. For example, 2018-01-02T15:03:04Z.

update_time

String

Indicates the time when a job is updated. For example, 2018-01-02T15:03:04Z.

items

Array

Indicates the list of image moderation results.

url

String

Indicates the URL of an image.

suggestion

String

For details, see the suggestion parameter in Table 2.

detail

Object

For details, see the detail parameter in Table 2.

confidence

Number

For details, see the confidence parameter in Table 2.

face_detail

List

For details, see the face_detail parameter in Table 2.

label

String

For details, see the label parameter in Table 2.

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
    GET https://moderation.ap-southeast-1.myhuaweicloud.com/v1.0/moderation/image/batch?job_id={job_id} 
    
    Request Header:   
    Content-Type:application/json 
    X-Auth-Token: MIINRwYJKoZIhvcNAQcCoIINODCCDTQCAQExDTALBglghkgBZQMEAgEwgguVBgkqhkiG...
  • Example successful response (processing)
    {
       "result":{
          "job_id": "53ba32e2-c96a-4d0a-a1df-6ddc75f40aed",
          "status": "running",
          "create_time": "2018-11-22T06:17:09Z",
          "update_time": "2018-11-22T06:17:16Z"
        }
    }
  • Example successful response (processed)
    {
       "result": {
          "job_id": "44d93b70-db01-4f96-a618-2a79c964c4b2",
          "status": "finish",
          "create_time": "2018-01-02T15:03:04Z",
          "update_time": "2018-01-02T15:03:04Z",
          "items": [
          {
            "url": "https://obs-test-llg.obs.myhuaweicloud.com/terrorism",
            "suggestion": "pass",
            "detail": {
              "politics": [],
              "terrorism": [
                {
                  "confidence": 0,
                  "label": "fire"
                },
                {
                  "confidence": 0.0268,
                  "label": "normal"
                }
              ]
            }
          },
          {
            "url": "https://obs-test-llg.obs.myhuaweicloud.com/clarity-detect",
            "suggestion": "pass",
            "detail": {
              "politics": [],
              "terrorism": [
                {
                  "confidence": 0,
                  "label": "knife"
                },
                {
                  "confidence": 0,
                  "label": "terrorist"
                },
                {
                  "confidence": 0.3086,
                  "label": "bloody"
                },
                {
                  "confidence": 0.6914,
                  "label": "normal"
                }
              ]
            }
          }
        ]
       }
    }
  • Example failed response
    {
        "error_code": "AIS.0005",
        "error_msg": "The service does not exist."
    }

Status Code

  • Normal

    200

  • Abnormal
    Table 3

    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