Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions,
see Getting Started with Amazon Web Services in China
(PDF).
Use DeleteTranscriptionJob
with an Amazon SDK or CLI
The following code examples show how to use DeleteTranscriptionJob
.
Action examples are code excerpts from larger programs and must be run in context. You can see this action in
context in the following code example:
- .NET
-
- Amazon SDK for .NET
-
/// <summary>
/// Delete a transcription job. Also deletes the transcript associated with the job.
/// </summary>
/// <param name="jobName">Name of the transcription job to delete.</param>
/// <returns>True if successful.</returns>
public async Task<bool> DeleteTranscriptionJob(string jobName)
{
var response = await _amazonTranscribeService.DeleteTranscriptionJobAsync(
new DeleteTranscriptionJobRequest()
{
TranscriptionJobName = jobName
});
return response.HttpStatusCode == HttpStatusCode.OK;
}
- CLI
-
- Amazon CLI
-
To delete one of your transcription jobs
The following delete-transcription-job
example deletes one of your transcription jobs.
aws transcribe delete-transcription-job \
--transcription-job-name your-transcription-job
This command produces no output.
For more information, see DeleteTranscriptionJob in the Amazon Transcribe Developer Guide.
- JavaScript
-
- SDK for JavaScript (v3)
-
Delete a transcription job.
// Import the required AWS SDK clients and commands for Node.js
import { DeleteTranscriptionJobCommand } from "@aws-sdk/client-transcribe";
import { transcribeClient } from "./libs/transcribeClient.js";
// Set the parameters
export const params = {
TranscriptionJobName: "JOB_NAME", // Required. For example, 'transciption_demo'
};
export const run = async () => {
try {
const data = await transcribeClient.send(
new DeleteTranscriptionJobCommand(params)
);
console.log("Success - deleted");
return data; // For unit tests.
} catch (err) {
console.log("Error", err);
}
};
run();
Create the client.
import { TranscribeClient } from "@aws-sdk/client-transcribe";
// Set the AWS Region.
const REGION = "REGION"; //e.g. "us-east-1"
// Create an Amazon Transcribe service client object.
const transcribeClient = new TranscribeClient({ region: REGION });
export { transcribeClient };
- Python
-
- SDK for Python (Boto3)
-
def delete_job(job_name, transcribe_client):
"""
Deletes a transcription job. This also deletes the transcript associated with
the job.
:param job_name: The name of the job to delete.
:param transcribe_client: The Boto3 Transcribe client.
"""
try:
transcribe_client.delete_transcription_job(TranscriptionJobName=job_name)
logger.info("Deleted job %s.", job_name)
except ClientError:
logger.exception("Couldn't delete job %s.", job_name)
raise
For a complete list of Amazon SDK developer guides and code examples, see
Using this service with an Amazon SDK.
This topic also includes information about getting started and details about previous SDK versions.