回调信息

最近更新时间:2023-08-10 18:13:42

我的收藏

功能说明

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

回调内容

任务完成后,系统会向您设置的回调地址发送回调内容,包含完整节点数据的内容展示如下:
<Response>
<EventName>TaskFinish</EventName>
<JobsDetail>
<Code>Success</Code>
<CreationTime>2022-06-30T19:14:31+0800</CreationTime>
<EndTime>2022-06-30T19:14:36+0800</EndTime>
<Input>
<BucketId>test-123456789</BucketId>
<Object>input/demo.mp4</Object>
<Region>ap-chongqing</Region>
</Input>
<JobId>jd0c0da74f86511ec8a5a87e016101404</JobId>
<Message/>
<Operation>
<MediaInfo>
<Format>
<Bitrate>2629.749000</Bitrate>
<Duration>215.680000</Duration>
<FormatLongName>QuickTime / MOV</FormatLongName>
<FormatName>mov,mp4,m4a,3gp,3g2,mj2</FormatName>
<NumProgram>0</NumProgram>
<NumStream>2</NumStream>
<Size>70898041</Size>
<StartTime>0.000000</StartTime>
</Format>
<Stream>
<Audio>
<Bitrate>256.000000</Bitrate>
<Channel>2</Channel>
<ChannelLayout>stereo</ChannelLayout>
<CodecLongName>AAC (Advanced Audio Coding)</CodecLongName>
<CodecName>aac</CodecName>
<CodecTag>0x6134706d</CodecTag>
<CodecTagString>mp4a</CodecTagString>
<CodecTimeBase>1/48000</CodecTimeBase>
<Duration>215.637000</Duration>
<Index>1</Index>
<Language>eng</Language>
<SampleFmt>fltp</SampleFmt>
<SampleRate>48000</SampleRate>
<StartTime>0.000000</StartTime>
<Timebase>1/48000</Timebase>
</Audio>
<Subtitle/>
<Video>
<AvgFps>24.000000</AvgFps>
<Bitrate>2369.296000</Bitrate>
<CodecLongName>H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10</CodecLongName>
<CodecName>h264</CodecName>
<CodecTag>0x31637661</CodecTag>
<CodecTagString>avc1</CodecTagString>
<CodecTimeBase>1/12288</CodecTimeBase>
<ColorPrimaries>unknown</ColorPrimaries>
<ColorRange>unknown</ColorRange>
<ColorTransfer>unknown</ColorTransfer>
<Duration>215.583333</Duration>
<Fps>24.000000</Fps>
<HasBFrame>2</HasBFrame>
<Height>1080</Height>
<Index>0</Index>
<Language>und</Language>
<Level>40</Level>
<NumFrames>5174</NumFrames>
<PixFormat>yuv420p</PixFormat>
<Profile>High</Profile>
<RefFrames>1</RefFrames>
<Rotation>0.000000</Rotation>
<StartTime>0.000000</StartTime>
<Timebase>1/12288</Timebase>
<Width>1920</Width>
</Video>
</Stream>
</MediaInfo>
<MediaResult>
<OutputFile>
<Bucket>test-123456789</Bucket>
<Md5Info>
<Md5>59a4edd95c6ddca43277d82cf33edc0d</Md5>
<ObjectName>output/segment-0</ObjectName>
</Md5Info>
<Md5Info>
<Md5>7fdacd7f2e2dbdc1dc3ccc00f96893b5</Md5>
<ObjectName>output/segment-1</ObjectName>
</Md5Info>
<Md5Info>
<Md5>4c377ddb6f65021f6741dbd45bbff654</Md5>
<ObjectName>output/segment-2</ObjectName>
</Md5Info>
<Md5Info>
<Md5>59317dbc9db6d4d6fb723e3005809c01</Md5>
<ObjectName>output/segment-3</ObjectName>
</Md5Info>
<Md5Info>
<Md5>a81091e57005eece211b5f60bfbddea1</Md5>
<ObjectName>output/segment-4</ObjectName>
</Md5Info>
<Md5Info>
<Md5>7b87e88264a983a06b17558c8a3a2bd8</Md5>
<ObjectName>output/segment-5</ObjectName>
</Md5Info>
<Md5Info>
<Md5>607b2abc29ed11ad1d2f678b594c6ffa</Md5>
<ObjectName>output/segment-6</ObjectName>
</Md5Info>
<Md5Info>
<Md5>4fe2d33dc9d08a5ea9d5d6db0f724008</Md5>
<ObjectName>output/segment-7</ObjectName>
</Md5Info>
<Md5Info>
<Md5>a84dd4f738ce81f4e3da55b393b2fae4</Md5>
<ObjectName>output/segment-8</ObjectName>
</Md5Info>
<ObjectName>0</ObjectName>
<ObjectName>1</ObjectName>
<ObjectName>2</ObjectName>
<ObjectName>3</ObjectName>
<ObjectName>4</ObjectName>
<ObjectName>5</ObjectName>
<ObjectName>6</ObjectName>
<ObjectName>7</ObjectName>
<ObjectName>8</ObjectName>
<ObjectPrefix>output/segment-</ObjectPrefix>
<Region>ap-chongqing</Region>
</OutputFile>
</MediaResult>
<Output>
<Bucket>test-123456789</Bucket>
<Object>output/segment-${number}</Object>
<Region>ap-chongqing</Region>
</Output>
<Segment>
<Duration>25</Duration>
<Format>mp4</Format>
<HlsEncrypt>
<IsHlsEncrypt>false</IsHlsEncrypt>
<UriKey/>
</HlsEncrypt>
</Segment>
<UserData>This is my Segment job.</UserData>
<JobLevel>0</JobLevel>
</Operation>
<QueueId>p2242ab62c7c94486915508540933a2c6</QueueId>
<StartTime>2022-06-30T19:14:32+0800</StartTime>
<State>Success</State>
<Tag>Segment</Tag>
</JobsDetail>
</Response>
具体的数据内容如下:
节点名称(关键字)
父节点
描述
类型
Response
保存结果的容器
Container
Container 节点 Response 的内容:
节点名称(关键字)
父节点
描述
类型
EventName
Response
固定值,为 TaskFinish
String
JobsDetail
Response
同提交转封装任务接口中的 Response.JobsDetail
Container 数组
如果任务是通过工作流触发的,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:14:31+0800</CreationTime>
<EndTime>2022-06-30T19:14:36+0800</EndTime>
<Input>
<BucketId>test-123456789</BucketId>
<Object>input/demo.mp4</Object>
<Region>ap-chongqing</Region>
</Input>
<JobId>jd0c0da74f86511ec8a5a87e016101404</JobId>
<Message/>
<Operation>
<MediaInfo>
<Format>
<Bitrate>2629.749000</Bitrate>
<Duration>215.680000</Duration>
<FormatLongName>QuickTime / MOV</FormatLongName>
<FormatName>mov,mp4,m4a,3gp,3g2,mj2</FormatName>
<NumProgram>0</NumProgram>
<NumStream>2</NumStream>
<Size>70898041</Size>
<StartTime>0.000000</StartTime>
</Format>
<Stream>
<Audio>
<Bitrate>256.000000</Bitrate>
<Channel>2</Channel>
<ChannelLayout>stereo</ChannelLayout>
<CodecLongName>AAC (Advanced Audio Coding)</CodecLongName>
<CodecName>aac</CodecName>
<CodecTag>0x6134706d</CodecTag>
<CodecTagString>mp4a</CodecTagString>
<CodecTimeBase>1/48000</CodecTimeBase>
<Duration>215.637000</Duration>
<Index>1</Index>
<Language>eng</Language>
<SampleFmt>fltp</SampleFmt>
<SampleRate>48000</SampleRate>
<StartTime>0.000000</StartTime>
<Timebase>1/48000</Timebase>
</Audio>
<Subtitle/>
<Video>
<AvgFps>24.000000</AvgFps>
<Bitrate>2369.296000</Bitrate>
<CodecLongName>H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10</CodecLongName>
<CodecName>h264</CodecName>
<CodecTag>0x31637661</CodecTag>
<CodecTagString>avc1</CodecTagString>
<CodecTimeBase>1/12288</CodecTimeBase>
<ColorPrimaries>unknown</ColorPrimaries>
<ColorRange>unknown</ColorRange>
<ColorTransfer>unknown</ColorTransfer>
<Duration>215.583333</Duration>
<Fps>24.000000</Fps>
<HasBFrame>2</HasBFrame>
<Height>1080</Height>
<Index>0</Index>
<Language>und</Language>
<Level>40</Level>
<NumFrames>5174</NumFrames>
<PixFormat>yuv420p</PixFormat>
<Profile>High</Profile>
<RefFrames>1</RefFrames>
<Rotation>0.000000</Rotation>
<StartTime>0.000000</StartTime>
<Timebase>1/12288</Timebase>
<Width>1920</Width>
</Video>
</Stream>
</MediaInfo>
<MediaResult>
<OutputFile>
<Bucket>test-123456789</Bucket>
<Md5Info>
<Md5>59a4edd95c6ddca43277d82cf33edc0d</Md5>
<ObjectName>output/segment-0</ObjectName>
</Md5Info>
<Md5Info>
<Md5>7fdacd7f2e2dbdc1dc3ccc00f96893b5</Md5>
<ObjectName>output/segment-1</ObjectName>
</Md5Info>
<Md5Info>
<Md5>4c377ddb6f65021f6741dbd45bbff654</Md5>
<ObjectName>output/segment-2</ObjectName>
</Md5Info>
<Md5Info>
<Md5>59317dbc9db6d4d6fb723e3005809c01</Md5>
<ObjectName>output/segment-3</ObjectName>
</Md5Info>
<Md5Info>
<Md5>a81091e57005eece211b5f60bfbddea1</Md5>
<ObjectName>output/segment-4</ObjectName>
</Md5Info>
<Md5Info>
<Md5>7b87e88264a983a06b17558c8a3a2bd8</Md5>
<ObjectName>output/segment-5</ObjectName>
</Md5Info>
<Md5Info>
<Md5>607b2abc29ed11ad1d2f678b594c6ffa</Md5>
<ObjectName>output/segment-6</ObjectName>
</Md5Info>
<Md5Info>
<Md5>4fe2d33dc9d08a5ea9d5d6db0f724008</Md5>
<ObjectName>output/segment-7</ObjectName>
</Md5Info>
<Md5Info>
<Md5>a84dd4f738ce81f4e3da55b393b2fae4</Md5>
<ObjectName>output/segment-8</ObjectName>
</Md5Info>
<ObjectName>0</ObjectName>
<ObjectName>1</ObjectName>
<ObjectName>2</ObjectName>
<ObjectName>3</ObjectName>
<ObjectName>4</ObjectName>
<ObjectName>5</ObjectName>
<ObjectName>6</ObjectName>
<ObjectName>7</ObjectName>
<ObjectName>8</ObjectName>
<ObjectPrefix>output/segment-</ObjectPrefix>
<Region>ap-chongqing</Region>
</OutputFile>
</MediaResult>
<Output>
<Bucket>test-123456789</Bucket>
<Object>output/segment-${number}</Object>
<Region>ap-chongqing</Region>
</Output>
<Segment>
<Duration>25</Duration>
<Format>mp4</Format>
<HlsEncrypt>
<IsHlsEncrypt>false</IsHlsEncrypt>
<UriKey/>
</HlsEncrypt>
</Segment>
<UserData>This is my Segment job.</UserData>
<JobLevel>0</JobLevel>
</Operation>
<QueueId>p2242ab62c7c94486915508540933a2c6</QueueId>
<StartTime>2022-06-30T19:14:32+0800</StartTime>
<State>Success</State>
<Tag>Segment</Tag>
</JobsDetail>
</Response>

案例 2:通过工作流触发的任务回调

<Response>
<EventName>TaskFinish</EventName>
<JobsDetail>
<Code>Success</Code>
<CreationTime>2022-06-30T19:14:31+0800</CreationTime>
<EndTime>2022-06-30T19:14:36+0800</EndTime>
<Input>
<BucketId>test-123456789</BucketId>
<Object>input/demo.mp4</Object>
<Region>ap-chongqing</Region>
<CosHeaders>
<Key>Content-Type</Key>
<Value>video/mp4</Value>
</CosHeaders>
<CosHeaders>
<Key>x-cos-request-id</Key>
<Value>NjJiZDYwYTFfNjUzYTYyNjRfZjEwZl8xMmZhYzY5</Value>
</CosHeaders>
<CosHeaders>
<Key>EventName</Key>
<Value>cos:ObjectCreated:Put</Value>
</CosHeaders>
<CosHeaders>
<Key>Size</Key>
<Value>1424687</Value>
</CosHeaders>
</Input>
<JobId>jd0c0da74f86511ec8a5a87e016101404</JobId>
<Message/>
<Operation>
<MediaInfo>
<Format>
<Bitrate>2629.749000</Bitrate>
<Duration>215.680000</Duration>
<FormatLongName>QuickTime / MOV</FormatLongName>
<FormatName>mov,mp4,m4a,3gp,3g2,mj2</FormatName>
<NumProgram>0</NumProgram>
<NumStream>2</NumStream>
<Size>70898041</Size>
<StartTime>0.000000</StartTime>
</Format>
<Stream>
<Audio>
<Bitrate>256.000000</Bitrate>
<Channel>2</Channel>
<ChannelLayout>stereo</ChannelLayout>
<CodecLongName>AAC (Advanced Audio Coding)</CodecLongName>
<CodecName>aac</CodecName>
<CodecTag>0x6134706d</CodecTag>
<CodecTagString>mp4a</CodecTagString>
<CodecTimeBase>1/48000</CodecTimeBase>
<Duration>215.637000</Duration>
<Index>1</Index>
<Language>eng</Language>
<SampleFmt>fltp</SampleFmt>
<SampleRate>48000</SampleRate>
<StartTime>0.000000</StartTime>
<Timebase>1/48000</Timebase>
</Audio>
<Subtitle/>
<Video>
<AvgFps>24.000000</AvgFps>
<Bitrate>2369.296000</Bitrate>
<CodecLongName>H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10</CodecLongName>
<CodecName>h264</CodecName>
<CodecTag>0x31637661</CodecTag>
<CodecTagString>avc1</CodecTagString>
<CodecTimeBase>1/12288</CodecTimeBase>
<ColorPrimaries>unknown</ColorPrimaries>
<ColorRange>unknown</ColorRange>
<ColorTransfer>unknown</ColorTransfer>
<Duration>215.583333</Duration>
<Fps>24.000000</Fps>
<HasBFrame>2</HasBFrame>
<Height>1080</Height>
<Index>0</Index>
<Language>und</Language>
<Level>40</Level>
<NumFrames>5174</NumFrames>
<PixFormat>yuv420p</PixFormat>
<Profile>High</Profile>
<RefFrames>1</RefFrames>
<Rotation>0.000000</Rotation>
<StartTime>0.000000</StartTime>
<Timebase>1/12288</Timebase>
<Width>1920</Width>
</Video>
</Stream>
</MediaInfo>
<MediaResult>
<OutputFile>
<Bucket>test-123456789</Bucket>
<Md5Info>
<Md5>59a4edd95c6ddca43277d82cf33edc0d</Md5>
<ObjectName>output/segment-0</ObjectName>
</Md5Info>
<Md5Info>
<Md5>7fdacd7f2e2dbdc1dc3ccc00f96893b5</Md5>
<ObjectName>output/segment-1</ObjectName>
</Md5Info>
<Md5Info>
<Md5>4c377ddb6f65021f6741dbd45bbff654</Md5>
<ObjectName>output/segment-2</ObjectName>
</Md5Info>
<Md5Info>
<Md5>59317dbc9db6d4d6fb723e3005809c01</Md5>
<ObjectName>output/segment-3</ObjectName>
</Md5Info>
<Md5Info>
<Md5>a81091e57005eece211b5f60bfbddea1</Md5>
<ObjectName>output/segment-4</ObjectName>
</Md5Info>
<Md5Info>
<Md5>7b87e88264a983a06b17558c8a3a2bd8</Md5>
<ObjectName>output/segment-5</ObjectName>
</Md5Info>
<Md5Info>
<Md5>607b2abc29ed11ad1d2f678b594c6ffa</Md5>
<ObjectName>output/segment-6</ObjectName>
</Md5Info>
<Md5Info>
<Md5>4fe2d33dc9d08a5ea9d5d6db0f724008</Md5>
<ObjectName>output/segment-7</ObjectName>
</Md5Info>
<Md5Info>
<Md5>a84dd4f738ce81f4e3da55b393b2fae4</Md5>
<ObjectName>output/segment-8</ObjectName>
</Md5Info>
<ObjectName>0</ObjectName>
<ObjectName>1</ObjectName>
<ObjectName>2</ObjectName>
<ObjectName>3</ObjectName>
<ObjectName>4</ObjectName>
<ObjectName>5</ObjectName>
<ObjectName>6</ObjectName>
<ObjectName>7</ObjectName>
<ObjectName>8</ObjectName>
<ObjectPrefix>output/segment-</ObjectPrefix>
<Region>ap-chongqing</Region>
</OutputFile>
</MediaResult>
<Output>
<Bucket>test-123456789</Bucket>
<Object>output/segment-${number}</Object>
<Region>ap-chongqing</Region>
</Output>
<Segment>
<Duration>25</Duration>
<Format>mp4</Format>
<HlsEncrypt>
<IsHlsEncrypt>false</IsHlsEncrypt>
<UriKey/>
</HlsEncrypt>
</Segment>
<UserData>This is my Segment job.</UserData>
<JobLevel>0</JobLevel>
</Operation>
<QueueId>p2242ab62c7c94486915508540933a2c6</QueueId>
<StartTime>2022-06-30T19:14:32+0800</StartTime>
<State>Success</State>
<Tag>Segment</Tag>
<Workflow>
<Name>Segment_1581665960537</Name>
<RunId>ic90edd59f84f11ec9d4f525400a3c59f</RunId>
<WorkflowId>web6ac56c1ef54dbfa44d7f4103203be9</WorkflowId>
<WorkflowName>workflow-test</WorkflowName>
</Workflow>
</JobsDetail>
</Response>

案例 3:通过工作流触发的任务回调, 格式为 JSON

{
"EventName": "TaskFinish",
"JobsDetail": [{
"Code": "Success",
"CreationTime": "2022-06-30T19:14:31+0800",
"EndTime": "2022-06-30T19:14:36+0800",
"Input": {
"BucketId": "test-123456789",
"Object": "input/demo.mp4",
"Region": "ap-chongqing",
"CosHeaders": [{
"Key": "Content-Type",
"Value": "video/mp4"
},
{
"Key": "x-cos-request-id",
"Value": "NjJiZDYwYTFfNjUzYTYyNjRfZjEwZl8xMmZhYzY5"
},
{
"Key": "EventName",
"Value": "cos:ObjectCreated:Put"
},
{
"Key": "Size",
"Value": "1424687"
}
]
},
"JobId": "jd0c0da74f86511ec8a5a87e016101404",
"Operation": {
"MediaInfo": {
"Format": {
"Bitrate": "2629.749000",
"Duration": "215.680000",
"FormatLongName": "QuickTime / MOV",
"FormatName": "mov,mp4,m4a,3gp,3g2,mj2",
"NumProgram": "0",
"NumStream": "2",
"Size": "70898041",
"StartTime": "0.000000"
},
"Stream": {
"Audio": [{
"Bitrate": "256.000000",
"Channel": "2",
"ChannelLayout": "stereo",
"CodecLongName": "AAC (Advanced Audio Coding)",
"CodecName": "aac",
"CodecTag": "0x6134706d",
"CodecTagString": "mp4a",
"CodecTimeBase": "1/48000",
"Duration": "215.637000",
"Index": "1",
"Language": "eng",
"SampleFmt": "fltp",
"SampleRate": "48000",
"StartTime": "0.000000",
"Timebase": "1/48000"
}],
"Video": [{
"AvgFps": "24.000000",
"Bitrate": "2369.296000",
"CodecLongName": "H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10",
"CodecName": "h264",
"CodecTag": "0x31637661",
"CodecTagString": "avc1",
"CodecTimeBase": "1/12288",
"ColorPrimaries": "unknown",
"ColorRange": "unknown",
"ColorTransfer": "unknown",
"Duration": "215.583333",
"Fps": "24.000000",
"HasBFrame": "2",
"Height": "1080",
"Index": "0",
"Language": "und",
"Level": "40",
"NumFrames": "5174",
"PixFormat": "yuv420p",
"Profile": "High",
"RefFrames": "1",
"Rotation": "0.000000",
"StartTime": "0.000000",
"Timebase": "1/12288",
"Width": "1920"
}]
}
},
"MediaResult": {
"OutputFile": {
"Bucket": "test-123456789",
"Md5Info": [{
"Md5": "59a4edd95c6ddca43277d82cf33edc0d",
"ObjectName": "output/segment-0"
},
{
"Md5": "7fdacd7f2e2dbdc1dc3ccc00f96893b5",
"ObjectName": "output/segment-1"
},
{
"Md5": "4c377ddb6f65021f6741dbd45bbff654",
"ObjectName": "output/segment-2"
},
{
"Md5": "59317dbc9db6d4d6fb723e3005809c01",
"ObjectName": "output/segment-3"
},
{
"Md5": "a81091e57005eece211b5f60bfbddea1",
"ObjectName": "output/segment-4"
},
{
"Md5": "7b87e88264a983a06b17558c8a3a2bd8",
"ObjectName": "output/segment-5"
},
{
"Md5": "607b2abc29ed11ad1d2f678b594c6ffa",
"ObjectName": "output/segment-6"
},
{
"Md5": "4fe2d33dc9d08a5ea9d5d6db0f724008",
"ObjectName": "output/segment-7"
},
{
"Md5": "a84dd4f738ce81f4e3da55b393b2fae4",
"ObjectName": "output/segment-8"
}
],
"ObjectName": [
"0",
"1",
"2",
"3",
"4",
"5",
"6",
"7",
"8"
],
"ObjectPrefix": "output/segment-",
"Region": "ap-chongqing"
}
},
"Output": {
"Bucket": "test-123456789",
"Object": "output/segment-${number}",
"Region": "ap-chongqing"
},
"Segment": {
"Duration": "25",
"Format": "mp4",
"HlsEncrypt": {
"IsHlsEncrypt": "false"
}
},
"UserData": "This is my Segment job.",
"JobLevel": 0
},
"QueueId": "p2242ab62c7c94486915508540933a2c6",
"StartTime": "2022-06-30T19:14:32+0800",
"State": "Success",
"Tag": "Segment",
"Workflow": {
"Name": "Segment_1581665960537",
"RunId": "ic90edd59f84f11ec9d4f525400a3c59f",
"WorkflowId": "web6ac56c1ef54dbfa44d7f4103203be9",
"WorkflowName": "workflow-test"
}
}]
}