tencent cloud

Submitting Tasks
Last updated: 2025-09-08 16:56:47
Submitting Tasks
Last updated: 2025-09-08 16:56:47

Feature Description

Submit an Image Processing task.

Authorization Description

When using through a sub-account, you need to add corresponding permissions to the action in the authorization policy. For all supported operation APIs of Cloud Infinite (CI), see action.
When using the image asynchronous processing feature, you need to add the ci:CreateMediaJobs permission to the action in the authorization policy.
When using the asynchronous processing interface, you need to add the cam:passrole permission to the authorization policy action. The asynchronous processing interface performs read-write operations on COS resources through CAM's "role". The PassRole permission is used for role passing. For details, refer to Access Management > Write Operation > PassRole API.

Service Activation

To use this feature, you need to bind bucket and enable Cloud Infinite (CI) service in advance.
To use this feature, you need to enable Image Processing (Async) service in advance via the console or API.
Note:
Note: After binding Cloud Infinite (CI), if you manually perform bucket unbinding, you will not be able to continue using this feature.

Use Limits

When using this API, please confirm the related use limits. For details, see Usage Limits.

Fee Instructions

This API is a paid service. The incurred fees will be charged by Cloud Infinite. For billing details, see Image Processing Fees.


Request

Request sample

POST /jobs HTTP/1.1
Host: <BucketName-APPID>.ci.<Region>.myqcloud.com
Date: <GMT Date>
Authorization: <Auth String>
Content-Length: <length>
Content-Type: application/xml

<body>
Note:
Authorization: Auth String. For details, see the Request Signature document.

Request header

This API only uses common request headers. For details, see Common Request Headers documentation.

Request body

The following figure shows the request bodies required for implementing this request operation.
<Request>
<Tag>PicProcess</Tag>
<Input>
<Object>input/deer.jpg</Object>
</Input>
<Operation>
<TemplateId>t10461fe2bd5a649db9022452ec71e0381</TemplateId>
<Output>
<Region>ap-chongqing</Region>
<Bucket>test-123456789</Bucket>
<Object>output/out.jpg</Object>
</Output>
<UserData>This is my data.</UserData>
<JobLevel>0</JobLevel>
</Operation>
<CallBack>http://callback.demo.com</CallBack>
<CallBackFormat>JSON</CallBackFormat>
</Request>
The data are described as follows:
Node Name (Keyword)
Parent Node
Description
Type
Required or Not
Request
None.
Container for saving requests
Container
Yes
Container type Request data description as follows:
Node Name (Keyword)
Parent Node
Description
Type
Required or Not
Tag
Request
Create task Tag: PicProcess
String
Yes
Input
Request
File information to be operated
Container
Yes
Operation
Request
operation rule
Container
Yes
CallBackFormat
Request
Job callback format, JSON or XML, default XML, priority is higher than queue callback format
String
No
CallBackType
Request
Job callback type, Url or TDMQ, default Url, priority is higher than queue callback type
String
No
CallBack
Request
Job callback address, priority is higher than queue callback address. When set to no, it means the queue callback address does not generate callbacks.
String
No
CallBackMqConfig
Request
Task callback TDMQ configuration, required when CallBackType is TDMQ. For details, see CallBackMqConfig
Container
No
Container type Input data description as follows:
Node Name (Keyword)
Parent Node
Description
Type
Required or Not
Object
Request.Input
File path
String
Yes
Container type
Operation
data description as follows:
Node Name (Keyword)
Parent Node
Description
Type
Required or Not
TemplateId
Request.Operation
Image processing template ID, same as Template.TemplateId in the Create Image Processing Template API.
String
No
PicProcess
Request.Operation
Image processing parameter, same as Request.PicProcess in the Create Image Processing Template API.
Container
No
Output
Request.Operation
Output configuration
Container
Yes
UserData
Request.Operation
Pass through user information, printable ASCII, length not exceeding 1024
String
No
JobLevel
Request.Operation
Task priority, level limit: 0, 1, 2. The higher the level, the higher the task priority. Default is 0.
String
No
Note:
Image processing parameters must be set through TemplateId or PicProcess, with TemplateId having higher priority.
Container type
Output
data description as follows:
Node Name (Keyword)
Parent Node
Description
Type
Required or Not
Region
Request.Operation.Output
Region of the bucket
String
Yes
Bucket
Request.Operation.Output
Bucket for result storage
String
Yes
Object
Request.Operation.Output
result file name
String
Yes

Response

Response Headers

This API only returns the public response header. For details, see Common Response Headers documentation.

Response Body

The response body is returned as application/xml. An example including the complete node data is shown below:
<Response>
<JobsDetail>
<Code>Success</Code>
<Message/>
<JobId>c93984788066911ed89ed352d4d9d2084</JobId>
<State>Submitted</State>
<CreationTime>2022-07-18T15:16:43+0800</CreationTime>
<EndTime>-</EndTime>
<StartTime>-</StartTime>
<QueueId>p2911917386e148639319e13c285cc774</QueueId>
<Tag>PicProcess</Tag>
<Input>
<BucketId>test-1234567890</BucketId>
<Object>input/deer.jpg</Object>
<Region>ap-chongqing</Region>
</Input>
<Operation>
<Output>
<Bucket>test-1234567890</Bucket>
<Object>output/out.jpg</Object>
<Region>ap-chongqing</Region>
</Output>
<TemplateId>t10461fe2bd5a649db9022452ec71e0381</TemplateId>
<TemplateName>test</TemplateName>
<UserData>This is my data.</UserData>
<JobLevel>0</JobLevel>
</Operation>
</JobsDetail>
</Response>
The data are as follows:
Node Name (Keyword)
Parent Node
Description
Type
Response
None.
Container for saving results
Container
Container node Response content:
Node Name (Keyword)
Parent Node
Description
Type
JobsDetail
Response
Task Details
Container array
Container node
JobsDetail
content:
Node Name (Keyword)
Parent Node
Description
Type
Code
Response.JobsDetail
Error code, this parameter is valid only when State is Failed
String
Message
Response.JobsDetail
Error description, this parameter is valid only when State is Failed
String
JobId
Response.JobsDetail
ID of the newly created task
String
Tag
Response.JobsDetail
Tag of the newly created task: PicProcess
String
State
Response.JobsDetail
Task Status
Submitted: submitted, pending execution
Running: executing
Success: execution successful
Failed: execution failed
Pause: task is paused. When the queue is paused, to be executed tasks change to paused state.
Cancel: task cancelled
String
CreationTime
Response.JobsDetail
Task creation time
String
StartTime
Response.JobsDetail
Task Start Time
String
EndTime
Response.JobsDetail
Task Closed At
String
QueueId
Response.JobsDetail
Task belonging to Queue ID
String
Input
Response.JobsDetail
Input resource address of the task
Container
Operation
Response.JobsDetail
Rule of the task
Container
Content of the Container node Input:
Node Name (Keyword)
Parent Node
Description
Type
Region
Response.JobsDetail.Input
Region of the bucket
String
BucketId
Response.JobsDetail.Input
Source file bucket
String
Object
Response.JobsDetail.Input
Source file name
String
Content of the Container node Operation:
Node Name (Keyword)
Parent Node
Description
Type
TemplateId
Response.JobsDetail.Operation
Task template ID
String
TemplateName
Response.JobsDetail.Operation
Task template name, return when TemplateId exists
String
PicProcess
Response.JobsDetail.Operation
Container
Output
Response.JobsDetail.Operation
Container
PicProcessResult
Response.JobsDetail.Operation
The output image information after image processing, do not return when the task is incomplete, fields included are the same as UploadResult
Container
UserData
Response.JobsDetail.Operation
Pass through user information
String
JobLevel
Response.JobsDetail.Operation
Task priority.
String

Error Code

This request returns common error responses and error codes. For more information, see Error Codes.

Practical Case

Case 1: Use an Image Processing Template ID

Request

POST /jobs HTTP/1.1
Authorization:q-sign-algorithm=sha1&q-ak=************************************&q-sign-time=1497530202;1497610202&q-key-time=1497530202;1497610202&q-header-list=&q-url-param-list=&q-signature=****************************************
Host:test-1234567890.ci.ap-chongqing.myqcloud.com
Content-Length: 166
Content-Type: application/xml

<Request>
<Tag>PicProcess</Tag>
<Input>
<Object>input/deer.jpg</Object>
</Input>
<Operation>
<TemplateId>t10461fe2bd5a649db9022452ec71e0381</TemplateId>
<Output>
<Region>ap-chongqing</Region>
<Bucket>test-123456789</Bucket>
<Object>output/out.jpg</Object>
</Output>
<UserData>This is my data.</UserData>
<JobLevel>0</JobLevel>
</Operation>
<CallBack>http://callback.demo.com</CallBack>
<CallBackFormat>JSON</CallBackFormat>
</Request>

Response

HTTP/1.1 200 OK
Content-Type: application/xml
Content-Length: 230
Connection: keep-alive
Date: Mon, 18 Jul 2022 19:37:29 GMT
Server: tencent-ci
x-ci-request-id: NjMxMDJhYTNfMThhYTk0MGFfYmU1OV8zZjc=

<Response>
<JobsDetail>
<Code>Success</Code>
<Message/>
<JobId>c93984788066911ed89ed352d4d9d2084</JobId>
<State>Submitted</State>
<CreationTime>2022-07-18T15:16:43+0800</CreationTime>
<EndTime>-</EndTime>
<StartTime>-</StartTime>
<QueueId>p2911917386e148639319e13c285cc774</QueueId>
<Tag>PicProcess</Tag>
<Input>
<BucketId>test-1234567890</BucketId>
<Object>input/deer.jpg</Object>
<Region>ap-chongqing</Region>
</Input>
<Operation>
<Output>
<Bucket>test-1234567890</Bucket>
<Object>output/out.jpg</Object>
<Region>ap-chongqing</Region>
</Output>
<TemplateId>t10461fe2bd5a649db9022452ec71e0381</TemplateId>
<TemplateName>test</TemplateName>
<UserData>This is my data.</UserData>
<JobLevel>0</JobLevel>
</Operation>
</JobsDetail>
</Response>

Case 2: Use Image Processing Parameters

Request

POST /jobs HTTP/1.1
Authorization:q-sign-algorithm=sha1&q-ak=************************************&q-sign-time=1497530202;1497610202&q-key-time=1497530202;1497610202&q-header-list=&q-url-param-list=&q-signature=****************************************
Host:test-1234567890.ci.ap-chongqing.myqcloud.com
Content-Length: 166
Content-Type: application/xml

<Request>
<Tag>PicProcess</Tag>
<Input>
<Object>input/deer.jpg</Object>
</Input>
<Operation>
<PicProcess>
<IsPicInfo>true</IsPicInfo>
<ProcessRule>imageMogr2/rotate/90</ProcessRule>
</PicProcess>
<Output>
<Region>ap-chongqing</Region>
<Bucket>test-123456789</Bucket>
<Object>output/out.jpg</Object>
</Output>
<UserData>This is my data.</UserData>
<JobLevel>0</JobLevel>
</Operation>
<CallBack>http://callback.demo.com</CallBack>
<CallBackFormat>JSON</CallBackFormat>
</Request>

Response

HTTP/1.1 200 OK
Content-Type: application/xml
Content-Length: 230
Connection: keep-alive
Date: Mon, 18 Jul 2022 19:37:29 GMT
Server: tencent-ci
x-ci-request-id: NjMxMDJhYTNfMThhYTk0MGFfYmU1OV8zZjc=

<Response>
<JobsDetail>
<Code>Success</Code>
<Message/>
<JobId>c93984788066911ed89ed352d4d9d2084</JobId>
<State>Submitted</State>
<CreationTime>2022-07-18T15:16:43+0800</CreationTime>
<EndTime>-</EndTime>
<StartTime>-</StartTime>
<QueueId>p2911917386e148639319e13c285cc774</QueueId>
<Tag>PicProcess</Tag>
<Input>
<BucketId>test-1234567890</BucketId>
<Object>input/deer.jpg</Object>
<Region>ap-chongqing</Region>
</Input>
<Operation>
<Output>
<Bucket>test-1234567890</Bucket>
<Object>output/out.jpg</Object>
<Region>ap-chongqing</Region>
</Output>
<PicProcess>
<IsPicInfo>true</IsPicInfo>
<ProcessRule>imageMogr2/rotate/90</ProcessRule>
</PicProcess>
<UserData>This is my data.</UserData>
<JobLevel>0</JobLevel>
</Operation>
</JobsDetail>
</Response>

Was this page helpful?
You can also Contact Sales or Submit a Ticket for help.
Yes
No

Feedback