更新工作流

最近更新时间:2024-11-11 15:53:52

我的收藏

功能描述

更新工作流。



授权说明

授权策略中 action 设置为 ci:UpdateMediaWorkflow 。查看所有 action

服务开通

使用该功能需提前开通数据万象,并绑定存储桶。详情请参见 绑定存储桶

使用限制

使用该接口时,请先确认相关限制条件。详情请参见 使用限制

请求

请求示例

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

<body>
说明
Authorization: Auth String(详情请参见 请求签名 文档)。
通过子账号使用时,需要授予相关的权限,详情请参见 授权粒度详情 文档。

请求头

此接口仅使用公共请求头部,详情请参见 公共请求头部 文档。

请求体

该请求操作的实现需要有如下请求体:
<Request>
<MediaWorkflow>
<Name>workflow-1</Name>
<State>Active</State>
<Topology>
<Dependencies>
<Start>Snapshot_1581665960536,Transcode_1581665960538</Start>
<Snapshot_1581665960536>End</Snapshot_1581665960536>
<Transcode_1581665960538>Segment_15816659605667,SmartCover_1581665960539</Transcode_1581665960538>
<Segment_15816659605667>End</Segment_15816659605667>
<SmartCover_1581665960539>PicProcess_15816659605668</SmartCover_1581665960539>
<PicProcess_15816659605668>End</PicProcess_15816659605668>
</Dependencies>
<Nodes>
<Start>
<Type>Start</Type>
<Input>
<QueueId>p09d709939fef48a0a5c247ef39d90cec</QueueId>
<PicProcessQueueId>p2911917386e148639319e13c285cc774</PicProcessQueueId>
<ObjectPrefix>input/workflow-1</ObjectPrefix>
<NotifyConfig>
<State>On</State>
<Url>http://www.callback.com</Url>
<Event>TaskFinish,WorkflowFinish</Event>
<Type>Url</Type>
<ResultFormat>JSON</ResultFormat>
</NotifyConfig>
<ExtFilter>
<State>On</State>
<Video>true</Video>
<Audio>false</Audio>
<Image>false</Image>
<Custom>false</Custom>
<AllFile>false</AllFile>
</ExtFilter>
</Input>
</Start>
<Snapshot_1581665960536>
<Type>Snapshot</Type>
<Operation>
<TemplateId>t1460606b9752148c4ab182f55163ba7cd</TemplateId>
<Output>
<Region>ap-chongqing</Region>
<Bucket>test-1234567890</Bucket>
<Object>abc/${RunId}/snapshot-${number}.${Ext}</Object>
<SpriteObject>abc/${RunId}/sprite-${number}.${Ext}</SpriteObject>
</Output>
</Operation>
</Snapshot_1581665960536>
<Transcode_1581665960538>
<Type>Transcode</Type>
<Operation>
<TemplateId>t16e81a29fe48c4e23acefc247a7792b63</TemplateId>
<Output>
<Region>ap-chongqing</Region>
<Bucket>test-1234567890</Bucket>
<Object>bcd/${RunId}/trans.{Ext}</Object>
</Output>
</Operation>
</Transcode_1581665960538>
<Segment_15816659605667>
<Type>Segment</Type>
<Operation>
<Segment>
<Format>mkv</Format>
<Duration>25</Duration>
</Segment>
<Output>
<Region>ap-chongqing</Region>
<Bucket>test-1234567890</Bucket>
<Object>test-trans${Number}.{Ext}</Object>
</Output>
</Operation>
</Segment_15816659605667>
<SmartCover_1581665960539>
<Type>SmartCover</Type>
<Operation>
<TemplateId>t16e81a29fe48c4e23acefc247a7792b63</TemplateId>
<Output>
<Region>ap-chongqing</Region>
<Bucket>test-1234567890</Bucket>
<Object>abc/${RunId}/cover-${Number}.{Ext}</Object>
</Output>
</Operation>
</SmartCover_1581665960539>
<PicProcess_15816659605668>
<Type>PicProcess</Type>
<Operation>
<TemplateId>t1460606b9752148c4ab182f55163ba7cd</TemplateId>
<Output>
<Region>ap-chongqing</Region>
<Bucket>test-1234567890</Bucket>
<Object>bcd/${RunId}/pic.{Ext}</Object>
</Output>
</Operation>
</PicProcess_15816659605668>
</Nodes>
</Topology>
</MediaWorkflow>
</Request>
具体数据描述如下:
节点名称(关键字)
父节点
描述
类型
是否必选
Request
Container

响应

响应头

此接口仅返回公共响应头部,详情请参见 公共响应头部 文档。

响应体

该响应体返回为 application/xml 数据,包含完整节点数据的内容展示如下:
<Response>
<RequestId>NjJmMWQxYjNfOTBmYTUwNjRfNWYyY18x</RequestId>
<MediaWorkflow>
<Name>workflow-1</Name>
<State>Active</State>
<WorkflowId>wc666d0b9f9dd47ae9137a096252d49f7</WorkflowId>
<BucketId>test-1234567890</BucketId>
<CreateTime>2022-07-14T12:37:28+0800</CreateTime>
<UpdateTime>2022-07-14T12:37:28+0800</UpdateTime>
<Topology>
<Dependencies>
<Start>Snapshot_1581665960536,Transcode_1581665960538</Start>
<Snapshot_1581665960536>End</Snapshot_1581665960536>
<Transcode_1581665960538>Segment_15816659605667,SmartCover_1581665960539</Transcode_1581665960538>
<Segment_15816659605667>End</Segment_15816659605667>
<SmartCover_1581665960539>PicProcess_15816659605668</SmartCover_1581665960539>
<PicProcess_15816659605668>End</PicProcess_15816659605668>
</Dependencies>
<Nodes>
<Start>
<Type>Start</Type>
<Input>
<QueueId>p09d709939fef48a0a5c247ef39d90cec</QueueId>
<PicProcessQueueId>p2911917386e148639319e13c285cc774</PicProcessQueueId>
<ObjectPrefix>input/workflow-1</ObjectPrefix>
<NotifyConfig>
<State>On</State>
<Url>http://www.callback.com</Url>
<Event>TaskFinish,WorkflowFinish</Event>
<Type>Url</Type>
<ResultFormat>JSON</ResultFormat>
</NotifyConfig>
<ExtFilter>
<State>On</State>
<Video>true</Video>
<Audio>false</Audio>
<Image>false</Image>
<Custom>false</Custom>
<AllFile>false</AllFile>
</ExtFilter>
</Input>
</Start>
<Snapshot_1581665960536>
<Type>Snapshot</Type>
<Operation>
<TemplateId>t1460606b9752148c4ab182f55163ba7cd</TemplateId>
<Output>
<Region>ap-chongqing</Region>
<Bucket>test-1234567890</Bucket>
<Object>abc/${RunId}/snapshot-${number}.${Ext}</Object>
<SpriteObject>abc/${RunId}/sprite-${number}.${Ext}</SpriteObject>
</Output>
</Operation>
</Snapshot_1581665960536>
<Transcode_1581665960538>
<Type>Transcode</Type>
<Operation>
<TemplateId>t16e81a29fe48c4e23acefc247a7792b63</TemplateId>
<Output>
<Region>ap-chongqing</Region>
<Bucket>test-1234567890</Bucket>
<Object>bcd/${RunId}/trans.{Ext}</Object>
</Output>
</Operation>
</Transcode_1581665960538>
<Segment_15816659605667>
<Type>Segment</Type>
<Operation>
<Segment>
<Format>mkv</Format>
<Duration>25</Duration>
</Segment>
<Output>
<Region>ap-chongqing</Region>
<Bucket>test-1234567890</Bucket>
<Object>test-trans${Number}.{Ext}</Object>
</Output>
</Operation>
</Segment_15816659605667>
<SmartCover_1581665960539>
<Type>SmartCover</Type>
<Operation>
<TemplateId>t16e81a29fe48c4e23acefc247a7792b63</TemplateId>
<Output>
<Region>ap-chongqing</Region>
<Bucket>test-1234567890</Bucket>
<Object>abc/${RunId}/cover-${Number}.{Ext}</Object>
</Output>
</Operation>
</SmartCover_1581665960539>
<PicProcess_15816659605668>
<Type>PicProcess</Type>
<Operation>
<TemplateId>t1460606b9752148c4ab182f55163ba7cd</TemplateId>
<Output>
<Region>ap-chongqing</Region>
<Bucket>test-1234567890</Bucket>
<Object>bcd/${RunId}/pic.{Ext}</Object>
</Output>
</Operation>
</PicProcess_15816659605668>
</Nodes>
</Topology>
</MediaWorkflow>
</Response>
具体的数据内容如下:
节点名称(关键字)
父节点
描述
类型
是否必选
Response
Container

错误码

该请求操作无特殊错误信息,常见的错误信息请参见 错误码 文档。

实际案例

请求1:更新工作流配置

PUT /workflow/wc666d0b9f9dd47ae9137a096252d49f7 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>
<MediaWorkflow>
<Name>workflow-1</Name>
<State>Active</State>
<Topology>
<Dependencies>
<Start>Snapshot_1581665960536,Transcode_1581665960538</Start>
<Snapshot_1581665960536>End</Snapshot_1581665960536>
<Transcode_1581665960538>Segment_15816659605667,SmartCover_1581665960539</Transcode_1581665960538>
<Segment_15816659605667>End</Segment_15816659605667>
<SmartCover_1581665960539>PicProcess_15816659605668</SmartCover_1581665960539>
<PicProcess_15816659605668>End</PicProcess_15816659605668>
</Dependencies>
<Nodes>
<Start>
<Type>Start</Type>
<Input>
<QueueId>p09d709939fef48a0a5c247ef39d90cec</QueueId>
<PicProcessQueueId>p2911917386e148639319e13c285cc774</PicProcessQueueId>
<ObjectPrefix>input/workflow-1</ObjectPrefix>
<NotifyConfig>
<State>On</State>
<Url>http://www.callback.com</Url>
<Event>TaskFinish,WorkflowFinish</Event>
<Type>Url</Type>
<ResultFormat>JSON</ResultFormat>
</NotifyConfig>
<ExtFilter>
<State>On</State>
<Video>true</Video>
<Audio>false</Audio>
<Image>false</Image>
<Custom>false</Custom>
<AllFile>false</AllFile>
</ExtFilter>
</Input>
</Start>
<Snapshot_1581665960536>
<Type>Snapshot</Type>
<Operation>
<TemplateId>t1460606b9752148c4ab182f55163ba7cd</TemplateId>
<Output>
<Region>ap-chongqing</Region>
<Bucket>test-1234567890</Bucket>
<Object>abc/${RunId}/snapshot-${number}.${Ext}</Object>
<SpriteObject>abc/${RunId}/sprite-${number}.${Ext}</SpriteObject>
</Output>
</Operation>
</Snapshot_1581665960536>
<Transcode_1581665960538>
<Type>Transcode</Type>
<Operation>
<TemplateId>t16e81a29fe48c4e23acefc247a7792b63</TemplateId>
<Output>
<Region>ap-chongqing</Region>
<Bucket>test-1234567890</Bucket>
<Object>bcd/${RunId}/trans.{Ext}</Object>
</Output>
</Operation>
</Transcode_1581665960538>
<Segment_15816659605667>
<Type>Segment</Type>
<Operation>
<Segment>
<Format>mkv</Format>
<Duration>25</Duration>
</Segment>
<Output>
<Region>ap-chongqing</Region>
<Bucket>test-1234567890</Bucket>
<Object>test-trans${Number}.{Ext}</Object>
</Output>
</Operation>
</Segment_15816659605667>
<SmartCover_1581665960539>
<Type>SmartCover</Type>
<Operation>
<TemplateId>t16e81a29fe48c4e23acefc247a7792b63</TemplateId>
<Output>
<Region>ap-chongqing</Region>
<Bucket>test-1234567890</Bucket>
<Object>abc/${RunId}/cover-${Number}.{Ext}</Object>
</Output>
</Operation>
</SmartCover_1581665960539>
<PicProcess_15816659605668>
<Type>PicProcess</Type>
<Operation>
<TemplateId>t1460606b9752148c4ab182f55163ba7cd</TemplateId>
<Output>
<Region>ap-chongqing</Region>
<Bucket>test-1234567890</Bucket>
<Object>bcd/${RunId}/pic.{Ext}</Object>
</Output>
</Operation>
</PicProcess_15816659605668>
</Nodes>
</Topology>
</MediaWorkflow>
</Request>

响应1

HTTP/1.1 200 OK
Content-Type: application/xml
Content-Length: 100
Connection: keep-alive
Date: Thu, 14 Jul 2022 12:37:29 GMT
Server: tencent-ci
x-ci-request-id: NjJmMWQxYjNfOTBmYTUwNjRfNWYyY18x

<Response>
<RequestId>NjJmMWQxYjNfOTBmYTUwNjRfNWYyY18x</RequestId>
<MediaWorkflow>
<Name>workflow-1</Name>
<State>Active</State>
<WorkflowId>wc666d0b9f9dd47ae9137a096252d49f7</WorkflowId>
<BucketId>test-1234567890</BucketId>
<CreateTime>2022-07-14T12:37:28+0800</CreateTime>
<UpdateTime>2022-07-14T12:37:28+0800</UpdateTime>
<Topology>
<Dependencies>
<Start>Snapshot_1581665960536,Transcode_1581665960538</Start>
<Snapshot_1581665960536>End</Snapshot_1581665960536>
<Transcode_1581665960538>Segment_15816659605667,SmartCover_1581665960539</Transcode_1581665960538>
<Segment_15816659605667>End</Segment_15816659605667>
<SmartCover_1581665960539>PicProcess_15816659605668</SmartCover_1581665960539>
<PicProcess_15816659605668>End</PicProcess_15816659605668>
</Dependencies>
<Nodes>
<Start>
<Type>Start</Type>
<Input>
<QueueId>p09d709939fef48a0a5c247ef39d90cec</QueueId>
<PicProcessQueueId>p2911917386e148639319e13c285cc774</PicProcessQueueId>
<ObjectPrefix>input/workflow-1</ObjectPrefix>
<NotifyConfig>
<State>On</State>
<Url>http://www.callback.com</Url>
<Event>TaskFinish,WorkflowFinish</Event>
<Type>Url</Type>
<ResultFormat>JSON</ResultFormat>
</NotifyConfig>
<ExtFilter>
<State>On</State>
<Video>true</Video>
<Audio>false</Audio>
<Image>false</Image>
<Custom>false</Custom>
<AllFile>false</AllFile>
</ExtFilter>
</Input>
</Start>
<Snapshot_1581665960536>
<Type>Snapshot</Type>
<Operation>
<TemplateId>t1460606b9752148c4ab182f55163ba7cd</TemplateId>
<Output>
<Region>ap-chongqing</Region>
<Bucket>test-1234567890</Bucket>
<Object>abc/${RunId}/snapshot-${number}.${Ext}</Object>
<SpriteObject>abc/${RunId}/sprite-${number}.${Ext}</SpriteObject>
</Output>
</Operation>
</Snapshot_1581665960536>
<Transcode_1581665960538>
<Type>Transcode</Type>
<Operation>
<TemplateId>t16e81a29fe48c4e23acefc247a7792b63</TemplateId>
<Output>
<Region>ap-chongqing</Region>
<Bucket>test-1234567890</Bucket>
<Object>bcd/${RunId}/trans.{Ext}</Object>
</Output>
</Operation>
</Transcode_1581665960538>
<Segment_15816659605667>
<Type>Segment</Type>
<Operation>
<Segment>
<Format>mkv</Format>
<Duration>25</Duration>
</Segment>
<Output>
<Region>ap-chongqing</Region>
<Bucket>test-1234567890</Bucket>
<Object>test-trans${Number}.{Ext}</Object>
</Output>
</Operation>
</Segment_15816659605667>
<SmartCover_1581665960539>
<Type>SmartCover</Type>
<Operation>
<TemplateId>t16e81a29fe48c4e23acefc247a7792b63</TemplateId>
<Output>
<Region>ap-chongqing</Region>
<Bucket>test-1234567890</Bucket>
<Object>abc/${RunId}/cover-${Number}.{Ext}</Object>
</Output>
</Operation>
</SmartCover_1581665960539>
<PicProcess_15816659605668>
<Type>PicProcess</Type>
<Operation>
<TemplateId>t1460606b9752148c4ab182f55163ba7cd</TemplateId>
<Output>
<Region>ap-chongqing</Region>
<Bucket>test-1234567890</Bucket>
<Object>bcd/${RunId}/pic.{Ext}</Object>
</Output>
</Operation>
</PicProcess_15816659605668>
</Nodes>
</Topology>
</MediaWorkflow>
</Response>

请求2:停用工作流

PUT /workflow/wc666d0b9f9dd47ae9137a096252d49f7?paused 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

响应2

HTTP/1.1 200 OK
Content-Length: 0
Connection: keep-alive
Date: Thu, 14 Jul 2022 12:37:29 GMT
Server: tencent-ci
x-ci-request-id: NjJmMWRiMDlfOTBmYTUwNjRfNWYzMl80

请求3:启用工作流

PUT /workflow/wc666d0b9f9dd47ae9137a096252d49f7?active HTTP/1.1
Authorization: q-sign-algorithm=sha1&q-ak=****************************KIDZfbOAo7cllgPvF9cXFrJD0a1ICvR****&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

响应3

HTTP/1.1 200 OK
Content-Length: 0
Connection: keep-alive
Date: Thu, 14 Jul 2022 12:37:29 GMT
Server: tencent-ci
x-ci-request-id: NjJmMWRiMDlfOTBmYTUwNjRfNWYzMl80