Updated on 2023-07-17 GMT+08:00

Job List Query

Function

This API queries a batch of image moderation jobs. You can specify the job status to filter the jobs.

URI

GET /v2/{project_id}/moderation/image/batch/jobs

Table 1 Path parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Project ID. For details about how to obtain the project ID, see Obtaining a Project ID.

Table 2 Query parameters

Parameter

Mandatory

Type

Description

status

No

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.

offset

No

Integer

Indicates the offset. The default value is 0.

limit

No

Integer

Indicates the maximum number of records returned on each page. The default value is the total number of jobs that meet the query criteria.

Request Parameters

Table 3 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

Indicates the user token.

Used to obtain the permission to operate APIs. For details about how to obtain the token, see Authentication. The value of X-Subject-Token in the response header is the token.

Response Parameters

Status code: 200

Table 4 Response body parameters

Parameter

Type

Description

result

Array of CheckTaskJobsItemsBody objects

Indicates the calling result of a successful API call.

This parameter is not included when the API fails to be called.

count

Integer

Indicates the total number of jobs that meet the query criteria.

Table 5 CheckTaskJobsItemsBody parameters

Parameter

Type

Description

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.

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.

Status code: 400

Table 6 Response body parameters

Parameter

Type

Description

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.

fail_category

String

Indicates the API calling failure scenario when there are multiple scenarios.

Example Requests

endpoint is the request URL for calling an API. Endpoints vary depending on services and regions. For details, see Endpoints.

For example, the endpoint of the service deployed in the CN-Hong Kong region is moderation.ap-southeast-1.myhuaweicloud.com, the request URL is https://moderation.ap-southeast-1.myhuaweicloud.com/v2/{project_id}/moderation/image/batch/jobs?status={status_type}, and project_id is the project ID. For details, see Obtaining a Project ID.

GET https://{endpoint}/v2/{project_id}/moderation/image/batch/jobs?status={status_type}

Example Responses

Status code: 200

Example of a successful response

{
  "result" : [ {
    "job_id" : "44d93b70-db01-4f96-a618-2a79c964c4b2",
    "status" : "finish",
    "create_time" : "2018-11-22T06:17:09Z",
    "update_time" : "2018-11-22T06:17:16Z"
  } ],
 "count" : 1
}

Status code: 400

Example of a failed response

{
  "error_code" : "AIS.0005",
  "error_msg" : "The service does not exist."
}

Status Codes

Status Code

Description

200

Example of a successful response

400

Example of a failed response

Error Codes

For details, see Error Codes.