有奖捉虫:云通信与企业服务文档专题,速来> HOT

功能说明

数据万象支持自定义设置回调 URL,在任务完成后,系统向该 URL 发送 HTTP POST 请求,请求体中包含通知内容。您可通过配置的回调地址及时了解任务处理的进展和状态,以便进行其他业务操作。

回调内容

任务完成后,系统会向您设置的回调地址发送回调内容,该响应体返回为 application/xml 数据,包含完整节点数据的内容展示如下:
<Response>
<EventName>TaskFinish</EventName>
<JobsDetail>
<Code>Success</Code>
<CreationTime>2022-06-30T19:06:27+0800</CreationTime>
<EndTime>2022-06-30T19:06:34+0800</EndTime>
<Input>
<BucketId>test-123456789</BucketId>
<Object>input/demo.mp4</Object>
<Region>ap-chongqing</Region>
</Input>
<JobId>jb01fe2f2f86411ec9ca1073b78d316d3</JobId>
<Message/>
<Operation>
<MediaInfo>
<Format>
<Bitrate>834736</Bitrate>
<Duration>13.654</Duration>
<NumStream>1</NumStream>
<Size>1424687</Size>
</Format>
<Stream>
<Audio>
<Bitrate>104047</Bitrate>
<Channel>2</Channel>
<CodecName>aac</CodecName>
<Duration>13.653</Duration>
<Index>1</Index>
<SampleFmt>fltp</SampleFmt>
<SampleRate>44100</SampleRate>
</Audio>
<Subtitle/>
<Video>
<AvgFps>25.000</AvgFps>
<Bitrate>763774</Bitrate>
<CodecName>h264</CodecName>
<ColorPrimaries>unknown</ColorPrimaries>
<ColorRange>tv</ColorRange>
<ColorTransfer>smpte170m</ColorTransfer>
<Duration>12.960</Duration>
<Fps>25.000</Fps>
<Height>960</Height>
<Index>0</Index>
<Level>1.000</Level>
<NumFrames>324</NumFrames>
<PixFormat>yuv420p</PixFormat>
<Profile>High</Profile>
<Rotation>0</Rotation>
<StartTime>0.000</StartTime>
<Timebase>1/12800</Timebase>
<Width>544</Width>
</Video>
</Stream>
</MediaInfo>
<MediaResult>
<OutputFile/>
</MediaResult>
<QualityEstimate>
<Score>6.460358</Score>
</QualityEstimate>
<UserData>This is my QualityEstimate job.</UserData>
</Operation>
<QueueId>p2242ab62c7c94486915508540933a2c6</QueueId>
<StartTime>2022-06-30T19:06:28+0800</StartTime>
<State>Success</State>
<Tag>QualityEstimate</Tag>
</JobsDetail>
</Response>
具体的数据内容如下:
节点名称(关键字)
父节点
描述
类型
Response
保存结果的容器
Container
Container 节点 Response 的内容:
节点名称(关键字)
父节点
描述
类型
EventName
Response
固定值,为 TaskFinish
String
JobsDetail
Response
任务的详细信息
Container
Container 节点 JobsDetail 的内容: 同提交视频质量分析任务接口中的 Response.JobsDetail
如果任务是通过工作流触发的,Response.JobsDetail.Input 还会包含 CosHeaders 节点,类型为 Container 数组。
Container 节点 CosHeaders 的内容:
节点名称(关键字)
父节点
描述
类型
Key
Response.JobsDetail.Input.CosHeaders
自定义 Header 的名称
String
Value
Response.JobsDetail.Input.CosHeaders
自定义 Header 的值
String
如果任务是通过工作流触发的,Response.JobsDetail 还会包含 Workflow 节点,类型为 Container。
Container 节点 Workflow 的内容:
节点名称(关键字)
父节点
描述
类型
RunId
Response.Workflow
工作流实例 ID
String
WorkflowId
Response.Workflow
工作流 ID
String
WorkflowName
Response.Workflow
工作流名称
String
Name
Response.Workflow
工作流节点名称
String

实际案例

案例 1:通过任务接口触发的任务回调

<Response>
<EventName>TaskFinish</EventName>
<JobsDetail>
<Code>Success</Code>
<CreationTime>2022-06-30T19:06:27+0800</CreationTime>
<EndTime>2022-06-30T19:06:34+0800</EndTime>
<Input>
<BucketId>test-123456789</BucketId>
<Object>input/demo.mp4</Object>
<Region>ap-chongqing</Region>
</Input>
<JobId>jb01fe2f2f86411ec9ca1073b78d316d3</JobId>
<Message/>
<Operation>
<MediaInfo>
<Format>
<Bitrate>834736</Bitrate>
<Duration>13.654</Duration>
<NumStream>1</NumStream>
<Size>1424687</Size>
</Format>
<Stream>
<Audio>
<Bitrate>104047</Bitrate>
<Channel>2</Channel>
<CodecName>aac</CodecName>
<Duration>13.653</Duration>
<Index>1</Index>
<SampleFmt>fltp</SampleFmt>
<SampleRate>44100</SampleRate>
</Audio>
<Subtitle/>
<Video>
<AvgFps>25.000</AvgFps>
<Bitrate>763774</Bitrate>
<CodecName>h264</CodecName>
<ColorPrimaries>unknown</ColorPrimaries>
<ColorRange>tv</ColorRange>
<ColorTransfer>smpte170m</ColorTransfer>
<Duration>12.960</Duration>
<Fps>25.000</Fps>
<Height>960</Height>
<Index>0</Index>
<Level>1.000</Level>
<NumFrames>324</NumFrames>
<PixFormat>yuv420p</PixFormat>
<Profile>High</Profile>
<Rotation>0</Rotation>
<StartTime>0.000</StartTime>
<Timebase>1/12800</Timebase>
<Width>544</Width>
</Video>
</Stream>
</MediaInfo>
<MediaResult>
<OutputFile/>
</MediaResult>
<QualityEstimate>
<Score>6.460358</Score>
</QualityEstimate>
<UserData>This is my QualityEstimate job.</UserData>
</Operation>
<QueueId>p2242ab62c7c94486915508540933a2c6</QueueId>
<StartTime>2022-06-30T19:06:28+0800</StartTime>
<State>Success</State>
<Tag>QualityEstimate</Tag>
</JobsDetail>
</Response>

案例 2:通过任务接口触发的任务回调, 格式为 JSON

{
"EventName": "TaskFinish",
"JobsDetail": {
"Code": "Success",
"CreationTime": "2022-06-30T19:06:27+0800",
"EndTime": "2022-06-30T19:06:34+0800",
"Input": {
"BucketId": "test-123456789",
"Object": "input/demo.mp4",
"Region": "ap-chongqing"
},
"JobId": "jb01fe2f2f86411ec9ca1073b78d316d3",
"Operation": {
"MediaInfo": {
"Format": {
"Bitrate": "834736",
"Duration": "13.654",
"NumStream": "1",
"Size": "1424687"
},
"Stream": {
"Audio": {
"Bitrate": "104047",
"Channel": "2",
"CodecName": "aac",
"Duration": "13.653",
"Index": "1",
"SampleFmt": "fltp",
"SampleRate": "44100"
},
"Video": {
"AvgFps": "25.000",
"Bitrate": "763774",
"CodecName": "h264",
"ColorPrimaries": "unknown",
"ColorRange": "tv",
"ColorTransfer": "smpte170m",
"Duration": "12.960",
"Fps": "25.000",
"Height": "960",
"Index": "0",
"Level": "1.000",
"NumFrames": "324",
"PixFormat": "yuv420p",
"Profile": "High",
"Rotation": "0",
"StartTime": "0.000",
"Timebase": "1/12800",
"Width": "544"
}
}
},
"MediaResult": {

},
"QualityEstimate": {
"Score": "6.460358"
},
"UserData": "This is my QualityEstimate job."
},
"QueueId": "p2242ab62c7c94486915508540933a2c6",
"StartTime": "2022-06-30T19:06:28+0800",
"State": "Success",
"Tag": "QualityEstimate"
}
}