Result Query
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.
URI
GET /v2/{project_id}/moderation/image/batch
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
project_id |
Yes |
String |
Project ID. For details about how to obtain the project ID, see Obtaining a Project ID. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
job_id |
Yes |
String |
Indicates the job ID. |
Request 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
Parameter |
Type |
Description |
---|---|---|
result |
CheckResultResultBody object |
Indicates the calling result of a successful API call. This parameter is not included when the API fails to be called. |
Parameter |
Type |
Description |
---|---|---|
job_id |
String |
Indicates the job ID. |
status |
String |
Indicates the job status. Possible values are as follows:
|
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 of CheckResultItemsBody objects |
Indicates the list of image moderation results. |
Parameter |
Type |
Description |
---|---|---|
url |
String |
Indicates the URL of an image. |
suggestion |
String |
Indicates whether the images pass the check.
NOTE:
|
detail |
ImageDetectionResultDetail object |
Indicates a list of detection results of a specific scenario. porn lists the detection results of pornographic elements. If the maximum confidence score of a specific detection scenario is smaller than the value of threshold, the list of detection results is empty. |
category_suggestions |
Map<String,String> |
Indicates the check result of each scenario. Possible values are as follows:
|
ocr_text |
String |
OCR recognition result |
Parameter |
Type |
Description |
---|---|---|
porn |
Array of ImageDetectionResultSimpleDetail objects |
Indicates that pornographic content was detected. |
Parameter |
Type |
Description |
---|---|---|
confidence |
Float |
Indicates the confidence score. The value ranges from 0 to 1. |
label |
String |
Indicates the label of each detection result. The options are as follows: porn: The image contains porn information. label classifies pornographic elements (porn information or sexy information).
|
Status code: 400
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?job_id={job_id}, project_id is the project ID, and job_id is the job ID returned by the API. For details, see Obtaining a Project ID.
GET https://{endpoint}/v2/{project_id}/moderation/image/batch?job_id={job_id}
Example Responses
Status code: 200
Example of a successful response
{ "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" : { } }, { "url" : "https://obs-test-llg.obs.myhuaweicloud.com/clarity-detect", "suggestion" : "pass", "detail" : { }, "ocr_text" : "fdfefdfdfdfd" } ] } }
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.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot