tencent cloud

Cloud Object Storage

Release Notes and Announcements
Release Notes
Announcements
Product Introduction
Overview
Features
Use Cases
Strengths
Concepts
Regions and Access Endpoints
Specifications and Limits
Service Regions and Service Providers
Billing
Billing Overview
Billing Method
Billable Items
Free Tier
Billing Examples
Viewing and Downloading Bill
Payment Overdue
FAQs
Getting Started
Console
Getting Started with COSBrowser
User Guide
Creating Request
Bucket
Object
Data Management
Batch Operation
Global Acceleration
Monitoring and Alarms
Operations Center
Data Processing
Content Moderation
Smart Toolbox
Data Processing Workflow
Application Integration
User Tools
Tool Overview
Installation and Configuration of Environment
COSBrowser
COSCLI (Beta)
COSCMD
COS Migration
FTP Server
Hadoop
COSDistCp
HDFS TO COS
GooseFS-Lite
Online Tools
Diagnostic Tool
Use Cases
Overview
Access Control and Permission Management
Performance Optimization
Accessing COS with AWS S3 SDK
Data Disaster Recovery and Backup
Domain Name Management Practice
Image Processing
Audio/Video Practices
Workflow
Direct Data Upload
Content Moderation
Data Security
Data Verification
Big Data Practice
COS Cost Optimization Solutions
Using COS in the Third-party Applications
Migration Guide
Migrating Local Data to COS
Migrating Data from Third-Party Cloud Storage Service to COS
Migrating Data from URL to COS
Migrating Data Within COS
Migrating Data Between HDFS and COS
Data Lake Storage
Cloud Native Datalake Storage
Metadata Accelerator
GooseFS
Data Processing
Data Processing Overview
Image Processing
Media Processing
Content Moderation
File Processing Service
File Preview
Troubleshooting
Obtaining RequestId
Slow Upload over Public Network
403 Error for COS Access
Resource Access Error
POST Object Common Exceptions
API Documentation
Introduction
Common Request Headers
Common Response Headers
Error Codes
Request Signature
Action List
Service APIs
Bucket APIs
Object APIs
Batch Operation APIs
Data Processing APIs
Job and Workflow
Content Moderation APIs
Cloud Antivirus API
SDK Documentation
SDK Overview
Preparations
Android SDK
C SDK
C++ SDK
.NET(C#) SDK
Flutter SDK
Go SDK
iOS SDK
Java SDK
JavaScript SDK
Node.js SDK
PHP SDK
Python SDK
React Native SDK
Mini Program SDK
Error Codes
Harmony SDK
Endpoint SDK Quality Optimization
Security and Compliance
Data Disaster Recovery
Data Security
Cloud Access Management
FAQs
Popular Questions
General
Billing
Domain Name Compliance Issues
Bucket Configuration
Domain Names and CDN
Object Operations
Logging and Monitoring
Permission Management
Data Processing
Data Security
Pre-signed URL Issues
SDKs
Tools
APIs
Agreements
Service Level Agreement
Privacy Policy
Data Processing And Security Agreement
Contact Us
Glossary

Job Operations

PDF
Focus Mode
Font Size
Last updated: 2024-02-02 16:51:03

Overview

This document provides an overview of APIs and SDK code samples for media processing jobs in CI, with the animated image job as an example.
API
Operation
Description
Creating job
Creates media processing job
Deleting job
Deletes media processing job (ongoing jobs cannot be deleted)
Querying job
Queries job
Querying job list
Queries the list of jobs in queue

Basic Operations

Creating job

Feature description

This API is used to create a media processing job.

Method prototype

public MediaJobResponse createMediaJobs(MediaJobsRequest req);

Parameter description

Request has the following sub-nodes:
Node Name (Keyword)
Parent Node
Description
Type
Required
Tag
Request
Job type: Animation (animated image job), Snapshot (screenshot job), Transcode (transcoding job), SmartCover (intelligent thumbnail job)
String
Yes
Input
Request
Information of the media file to be processed
Container
Yes
Operation
Request
Operation rule
Container
Yes
QueueId
Request
Queue ID of the job
String
Yes
Input has the following sub-nodes:
Node Name (Keyword)
Parent Node
Description
Type
Required
Object
Request.Input
Media filename
String
Yes
Operation has the following sub-nodes:
Node Name (Keyword)
Parent Node
Description
Type
Required
Animation
Request.Operation
Job type parameter. Same as Request.Animation in the animated image template creation API CreateMediaTemplate.
Container
No
Snapshot
Request.Operation
Job type parameter. Same as Request.Snapshot in the screenshot template creation API CreateMediaTemplate.
Container
No
Transcode
Request.Operation
Job type parameter. Same as Request.Transcode in the transcoding template creation API CreateMediaTemplate.
Container
No
Watermark
Request.Operation
Job type parameter. Same as Request.Watermark in the watermark template creation API CreateMediaTemplate.
Container
No
SmartCover
Request.Operation
This node is valid only when Tag is SmartCover. Currently, it is null.
Container
No
TemplateId
Request.Operation
Template ID
String
No
Output
Request.Operation
Result output address
Container
Yes
Note:
TemplateId is used with priority. If TemplateId is unavailable, the corresponding job type parameter is used.
Animation has the following sub-nodes:
Node Name (Keyword)
Parent Node
Description
Type
Required
Container
Request.Operation.Animation
Same as Request.Container in the animated image template creation API CreateMediaTemplate.
Container
No
Video
Request.Operation.Animation
Same as Request.Video in the animated image template creation API CreateMediaTemplate.
Container
No
TimeInterval
Request.Operation.Animation
Same as Request.TimeInterval in the animated image template creation API CreateMediaTemplate.
Container
No
Output has the following sub-nodes:
Node Name (Keyword)
Parent Node
Description
Type
Required
Region
Request.Operation.Output
Bucket region
String
Yes
Bucket
Request.Operation.Output
Result storage bucket
String
Yes
Object
Request.Operation.Output
Result filename.
String
Yes

Response description

Success: The job object response information is returned.
Failure: An error (such as the bucket does not exist) occurs, throwing the CosClientException or CosServiceException exception. For more information, see Troubleshooting.

Sample request

//1. Create a job request object
MediaJobsRequest request = new MediaJobsRequest();
//2. Add request parameters as detailed in the API documentation
request.setBucketName("examplebucket-1250000000");
request.setTag("Transcode");
request.getInput().setObject("1.mp4");
request.getOperation().setTemplateId("t0e09a9456d4124542b1f0e44d501*****");
request.getOperation().getOutput().setBucket("examplebucket-1250000000");
request.getOperation().getOutput().setRegion("ap-chongqing");
request.getOperation().getOutput().setObject("2.mp4");
request.setQueueId("p9900025e4ec44b5e8225e70a52170834");
//3. Call the API to get the job response object
MediaJobResponse response = client.createMediaJobs(request);

Canceling job

Feature description

This API is used to cancel a job that is not in progress.

Method prototype

public Boolean cancelMediaJob(MediaJobsRequest req);

Parameter description

Parameter
Description
Type
Required
bucketName
Bucket name in the format of BucketName-APPID. For more information, see Bucket Overview.
String
Yes
jobId
ID of the job to be deleted.
String
Yes

Response description

Success: A boolean type is returned, which is true upon success.
Failure: An error (such as authentication failure) occurs, throwing the "CosClientException" or "CosServiceException" exception. For more information, see Troubleshooting.

Sample request

MediaJobsRequest request = new MediaJobsRequest();
request.setBucketName("examplebucket-1250000000");
request.setJobId("jae776cb4ec3011eab2cdd3817d4*****");
Boolean response = client.cancelMediaJob(request);

Querying job

Feature description

This API is used to query the details of a job by job ID.

Method prototype

public MediaJobResponse describeMediaJob(MediaJobsRequest req);

Parameter description

Parameter
Description
Type
Required
bucketName
Bucket name in the format of BucketName-APPID. For more information, see Bucket Overview.
String
Yes
jobId
ID of the job to be queried.
String
Yes

Response description

Success: A job details response wrapper class is returned, which contains the job details object MediaJobObject.
Failure: An error (such as authentication failure) occurs, throwing the "CosClientException" or "CosServiceException" exception. For more information, see Troubleshooting.

Sample request

//1. Create a job request object
MediaJobsRequest request = new MediaJobsRequest();
//2. Add request parameters as detailed in the API documentation
request.setBucketName("examplebucket-1250000000");
request.setJobId("j29a82fea08ba11ebb54bc9d1c05*****");
//3. Call the API to get the job response object
MediaJobResponse response = client.describeMediaJob(request);

Querying job list

Feature description

This API is used to query the list of jobs in the queue.

Method prototype

public MediaListJobResponse describeMediaJobs(MediaJobsRequest cIMediaJobsRequest);

Parameter description

Node Name (Keyword)
Description
Type
Required
bucketName
Bucket name in the format of BucketName-APPID. For more information, see Bucket Overview.
String
Yes
queueId
ID of the queue from which jobs are pulled
String
Yes
tag
Job type: Animation
String
Yes
orderByTime
Desc (default) or Asc
String
No
nextToken
Context token for pagination
String
No
size
Maximum number of jobs that can be pulled. The default value is 10. The maximum value is 100.
Integer
No
states
Status of the jobs to pull. If you enter multiple job statuses, separate them with commas (,). Valid values: All (default), Submitted, Running, Success, Failed, Pause, Cancel
String
No
startCreationTime
Start time of the time range for job pulling in the format of %Y-%m-%dT%H:%m:%S%z.
String
No
endCreationTime
End time of the time range for job pulling in the format of %Y-%m-%dT%H:%m:%S%z.
String
No

Response description

Success: A job set response entity is returned.
Failure: An error (such as authentication failure) occurs, throwing the "CosClientException" or "CosServiceException" exception. For more information, see Troubleshooting.

Sample request

MediaJobsRequest request = new MediaJobsRequest();
request.setBucketName("examplebucket-1250000000");
request.setQueueId("p9900025e4ec44b5e8225e70a521*****");
request.setTag("Transcode");
MediaListJobResponse response = client.describeMediaJobs(request);
List<MediaJobObject> jobsDetail = response.getJobsDetail();


Help and Support

Was this page helpful?

Help us improve! Rate your documentation experience in 5 mins.

Feedback