Help Center/ Content Moderation/ API Reference/ APIs/ Audio Moderation/ Querying an Audio Moderation Job
Updated on 2024-11-04 GMT+08:00

Querying an Audio Moderation Job

Function

This API is used to query the processing status and result of an audio review job and return the recognition result to you.

URI

GET /v3/{project_id}/moderation/audio/jobs/{job_id}

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.

job_id

Yes

String

Job ID returned when a job is created

Request Parameters

Table 2 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

User token, which can be obtained by calling the IAM API (The token is the value of X-Subject-Token in the response header.)

Response Parameters

Status code: 200

Table 3 Response body parameters

Parameter

Type

Description

job_id

String

Job ID

status

String

Job status. The options are as follows:

  • running: The job is running.
  • succeeded: The job was executed successfully.
  • failed: The job failed.

result

result object

Job review result. This parameter is available when the job status is succeeded.

request_params

request_params object

Parameters for creating the job

create_time

String

Time when the job was created

update_time

String

Time when the job was updated

request_id

String

Unique ID of the request, which is used for troubleshooting. You are advised to save the ID.

Minimum length: 2

Maximum length: 64

Table 4 result

Parameter

Type

Description

suggestion

String

Whether the audio clip passes the check

  • block: It contain sensitive information and fail to pass the check.
  • pass: It does not contain sensitive information and passes the check.
  • review: It need to be manually reviewed.

details

Array of details objects

Review details

audio_text

String

Audio text

Table 5 details

Parameter

Type

Description

start_time

Float

Start time of the audio clip

suggestion

String

Suggestion for moderating the audio clip

  • block: It contain sensitive information and fail to pass the check.
  • review: It need to be manually reviewed.

end_time

Float

End time of the audio clip

label

String

Audio clip label. The options are as follows:

  • terrorism: terrorism-related information
  • porn: pornographic information
  • ban: banned information
  • abuse: abuse
  • ad: advertisement
  • ad_law: information that violates the advertisement law
  • moan: moan
  • meaningless: meaningless information

audio_text

String

Text of the audio clip

segments

Array of segments objects

List of hit risk segments. This field is unavailable if semantic algorithm models are hit.

Table 6 segments

Parameter

Type

Description

segment

String

Hit risk segment

Table 7 request_params

Parameter

Type

Description

event_type

String

Parameter event_type for creating the job

data

data object

Parameter data for creating the job

callback

String

Parameter callback for creating the job

categories

Array of strings

Parameter categories for creating the job

Table 8 data

Parameter

Type

Description

url

String

Parameter url for creating the job

Status code: 400

Table 9 Response body parameters

Parameter

Type

Description

error_code

String

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

Error message of a failed API call.

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

Example Request

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

For example, if the service is deployed in the CN North-Beijing4 region, the endpoint is moderation.cn-north-4.myhuaweicloud.com and the request URL is https://moderation.cn-north-4.myhuaweicloud.com/v3/{project_id}/moderation/audio/jobs/{job_id}. For details about how to obtain the project ID, see Obtaining a Project ID. job_id is the job ID returned when the job is created successfully.

GET https://{endpoint}/v3/{project_id}/moderation/audio/jobs/{job_id} 

Example Response

Status code: 200

Job status and result returned when the query is successful

{ 
  "job_id" : "01655654400_ad96b30f58cc40e8968e53f1f1e80021", 
  "status" : "succeeded", 
  "result" : { 
    "suggestion" : "block", 
    "details" : [ { 
      "start_time" : 0, 
      "suggestion" : "block", 
      "end_time" : 10, 
      "label" : "porn", 
      "audio_text" : "xxxx", 
      "segments" : [ { 
        "segment" : "xxx" 
      }, { 
        "segment" : "xxx" 
      }, { 
        "segment" : "xxx" 
      } ] 
    }, { 
      "start_time" : 30, 
      "suggestion" : "block", 
      "end_time" : 40, 
      "label" : "porn", 
      "audio_text" : "xxx", 
      "segments" : [ { 
        "segment" : "xx" 
      } ] 
    } ], 
    "audio_text" : "xxxxxx" 
  }, 
  "request_params" : { 
    "event_type" : "default", 
    "data" : { 
      "url" : "https://xxxx.wav" 
    }, 
    "callback" : "http://xxx", 
    "categories" : [ "porn", "ad" ] 
  }, 
  "create_time" : "2022-06-20 11:05:29", 
  "update_time" : "2022-06-20 11:07:08", 
  "request_id" : "2419446b1fe14203f64e4018d12db3dd" 
}

Status code: 400

Error cause returned when the query fails

{ 
  "error_code" : "AIS.0030", 
  "error_msg" : "Job not found" 
}

Status Codes

Status Code

Description

200

Example of a successful response

400

Example of a failed response

Error Codes

For details, see Error Codes.