功能说明
数据万象支持自定义设置回调 URL,在任务完成后,系统向该 URL 发送 HTTP POST 请求,请求体中包含通知内容。您可通过配置的回调地址及时了解任务处理的进展和状态,以便进行其他业务操作。
回调内容
任务完成后,系统会向您设置的回调地址发送回调内容,包含完整节点数据的内容展示如下:
<Response><EventName>TaskFinish</EventName><JobsDetail><State>Success</State><Tag>SpeechRecognition</Tag><Code>Success</Code><CreationTime>2022-09-02T10:25:38+0800</CreationTime><StartTime>2022-09-02T10:25:39+0800</StartTime><EndTime>2022-09-02T10:25:46+0800</EndTime><Input><BucketId>test-1234567890</BucketId><Object>minnong.mp3</Object><Region>ap-chongqing</Region></Input><JobId>s886c0a7c2a6611ed847a618901112dcf</JobId><QueueId>pe91d0af11fc14337987ff0c34f8b0886</QueueId><Message/><Operation><UserData>This is my SpeechRecognition job.</UserData><JobLevel>0</JobLevel><Output><Bucket>test-1234567890</Bucket><Object>/example.txt</Object><Region>ap-chongqing</Region></Output><SpeechRecognitionResult><AudioTime>19.7124</AudioTime><DetailObjectName>/example.txt.detail</DetailObjectName><ObjectName>/example.txt</ObjectName><Result>[0:3.320,0:19.712] 悯农,李绅,锄禾日当午,汗滴禾下土。谁知盘中餐,粒粒皆辛苦。</Result><ResultDetail><EndMs>19712</EndMs><FinalSentence>悯农,李绅,锄禾日当午,汗滴禾下土。谁知盘中餐,粒粒皆辛苦。</FinalSentence><SliceSentence>悯 农 , 李 绅 , 锄禾 日 当午 , 汗滴 禾 下 土 。 谁知 盘中餐 , 粒粒 皆 辛苦 。</SliceSentence><SpeakerId>0</SpeakerId><SpeechSpeed>2.4</SpeechSpeed><StartMs>3320</StartMs><Words><OffsetEndMs>2190</OffsetEndMs><OffsetStartMs>0</OffsetStartMs><VoiceType>0</VoiceType><Word>悯</Word></Words><Words><OffsetEndMs>2625</OffsetEndMs><OffsetStartMs>2190</OffsetStartMs><VoiceType>0</VoiceType><Word>农</Word></Words><Words><OffsetEndMs>2625</OffsetEndMs><OffsetStartMs>2190</OffsetStartMs><VoiceType>1</VoiceType><Word>,</Word></Words><Words><OffsetEndMs>3060</OffsetEndMs><OffsetStartMs>2625</OffsetStartMs><VoiceType>0</VoiceType><Word>李</Word></Words><Words><OffsetEndMs>3825</OffsetEndMs><OffsetStartMs>3060</OffsetStartMs><VoiceType>0</VoiceType><Word>绅</Word></Words><Words><OffsetEndMs>3825</OffsetEndMs><OffsetStartMs>3060</OffsetStartMs><VoiceType>1</VoiceType><Word>,</Word></Words><Words><OffsetEndMs>5040</OffsetEndMs><OffsetStartMs>3825</OffsetStartMs><VoiceType>0</VoiceType><Word>锄禾</Word></Words><Words><OffsetEndMs>5475</OffsetEndMs><OffsetStartMs>5040</OffsetStartMs><VoiceType>0</VoiceType><Word>日</Word></Words><Words><OffsetEndMs>6390</OffsetEndMs><OffsetStartMs>5475</OffsetStartMs><VoiceType>0</VoiceType><Word>当午</Word></Words><Words><OffsetEndMs>6390</OffsetEndMs><OffsetStartMs>5475</OffsetStartMs><VoiceType>1</VoiceType><Word>,</Word></Words><Words><OffsetEndMs>7365</OffsetEndMs><OffsetStartMs>6390</OffsetStartMs><VoiceType>0</VoiceType><Word>汗滴</Word></Words><Words><OffsetEndMs>7755</OffsetEndMs><OffsetStartMs>7365</OffsetStartMs><VoiceType>0</VoiceType><Word>禾</Word></Words><Words><OffsetEndMs>8130</OffsetEndMs><OffsetStartMs>7755</OffsetStartMs><VoiceType>0</VoiceType><Word>下</Word></Words><Words><OffsetEndMs>8850</OffsetEndMs><OffsetStartMs>8130</OffsetStartMs><VoiceType>0</VoiceType><Word>土</Word></Words><Words><OffsetEndMs>8850</OffsetEndMs><OffsetStartMs>8130</OffsetStartMs><VoiceType>1</VoiceType><Word>。</Word></Words><Words><OffsetEndMs>9915</OffsetEndMs><OffsetStartMs>8850</OffsetStartMs><VoiceType>0</VoiceType><Word>谁知</Word></Words><Words><OffsetEndMs>11130</OffsetEndMs><OffsetStartMs>9915</OffsetStartMs><VoiceType>0</VoiceType><Word>盘中餐</Word></Words><Words><OffsetEndMs>11130</OffsetEndMs><OffsetStartMs>9915</OffsetStartMs><VoiceType>1</VoiceType><Word>,</Word></Words><Words><OffsetEndMs>12045</OffsetEndMs><OffsetStartMs>11130</OffsetStartMs><VoiceType>0</VoiceType><Word>粒粒</Word></Words><Words><OffsetEndMs>12540</OffsetEndMs><OffsetStartMs>12045</OffsetStartMs><VoiceType>0</VoiceType><Word>皆</Word></Words><Words><OffsetEndMs>14745</OffsetEndMs><OffsetStartMs>12540</OffsetStartMs><VoiceType>0</VoiceType><Word>辛苦</Word></Words><Words><OffsetEndMs>14745</OffsetEndMs><OffsetStartMs>12540</OffsetStartMs><VoiceType>1</VoiceType><Word>。</Word></Words><WordsNum>22</WordsNum></ResultDetail></SpeechRecognitionResult><TemplateId>t14aea553bb55c468b963fafa472afc538</TemplateId><TemplateName>test</TemplateName></Operation></JobsDetail></Response>
具体的数据内容如下:
节点名称(关键字) | 父节点 | 描述 | 类型 |
Response | 无 | 保存结果的容器 | Container |
Container 节点 Response 的内容:
节点名称(关键字) | 父节点 | 描述 | 类型 |
EventName | Response | 固定值,为 TaskFinish | String |
JobsDetail | Response | 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><State>Success</State><Tag>SpeechRecognition</Tag><Code>Success</Code><CreationTime>2022-09-02T10:25:38+0800</CreationTime><StartTime>2022-09-02T10:25:39+0800</StartTime><EndTime>2022-09-02T10:25:46+0800</EndTime><Input><BucketId>test-1234567890</BucketId><Object>minnong.mp3</Object><Region>ap-chongqing</Region></Input><JobId>s886c0a7c2a6611ed847a618901112dcf</JobId><QueueId>pe91d0af11fc14337987ff0c34f8b0886</QueueId><Message/><Operation><UserData>This is my SpeechRecognition job.</UserData><JobLevel>0</JobLevel><Output><Bucket>test-1234567890</Bucket><Object>/example.txt</Object><Region>ap-chongqing</Region></Output><SpeechRecognitionResult><AudioTime>19.7124</AudioTime><DetailObjectName>/example.txt.detail</DetailObjectName><ObjectName>/example.txt</ObjectName><Result>[0:3.320,0:19.712] 悯农,李绅,锄禾日当午,汗滴禾下土。谁知盘中餐,粒粒皆辛苦。</Result><ResultDetail><EndMs>19712</EndMs><FinalSentence>悯农,李绅,锄禾日当午,汗滴禾下土。谁知盘中餐,粒粒皆辛苦。</FinalSentence><SliceSentence>悯 农 , 李 绅 , 锄禾 日 当午 , 汗滴 禾 下 土 。 谁知 盘中餐 , 粒粒 皆 辛苦 。</SliceSentence><SpeakerId>0</SpeakerId><SpeechSpeed>2.4</SpeechSpeed><StartMs>3320</StartMs><Words><OffsetEndMs>2190</OffsetEndMs><OffsetStartMs>0</OffsetStartMs><VoiceType>0</VoiceType><Word>悯</Word></Words><Words><OffsetEndMs>2625</OffsetEndMs><OffsetStartMs>2190</OffsetStartMs><VoiceType>0</VoiceType><Word>农</Word></Words><Words><OffsetEndMs>2625</OffsetEndMs><OffsetStartMs>2190</OffsetStartMs><VoiceType>1</VoiceType><Word>,</Word></Words><Words><OffsetEndMs>3060</OffsetEndMs><OffsetStartMs>2625</OffsetStartMs><VoiceType>0</VoiceType><Word>李</Word></Words><Words><OffsetEndMs>3825</OffsetEndMs><OffsetStartMs>3060</OffsetStartMs><VoiceType>0</VoiceType><Word>绅</Word></Words><Words><OffsetEndMs>3825</OffsetEndMs><OffsetStartMs>3060</OffsetStartMs><VoiceType>1</VoiceType><Word>,</Word></Words><Words><OffsetEndMs>5040</OffsetEndMs><OffsetStartMs>3825</OffsetStartMs><VoiceType>0</VoiceType><Word>锄禾</Word></Words><Words><OffsetEndMs>5475</OffsetEndMs><OffsetStartMs>5040</OffsetStartMs><VoiceType>0</VoiceType><Word>日</Word></Words><Words><OffsetEndMs>6390</OffsetEndMs><OffsetStartMs>5475</OffsetStartMs><VoiceType>0</VoiceType><Word>当午</Word></Words><Words><OffsetEndMs>6390</OffsetEndMs><OffsetStartMs>5475</OffsetStartMs><VoiceType>1</VoiceType><Word>,</Word></Words><Words><OffsetEndMs>7365</OffsetEndMs><OffsetStartMs>6390</OffsetStartMs><VoiceType>0</VoiceType><Word>汗滴</Word></Words><Words><OffsetEndMs>7755</OffsetEndMs><OffsetStartMs>7365</OffsetStartMs><VoiceType>0</VoiceType><Word>禾</Word></Words><Words><OffsetEndMs>8130</OffsetEndMs><OffsetStartMs>7755</OffsetStartMs><VoiceType>0</VoiceType><Word>下</Word></Words><Words><OffsetEndMs>8850</OffsetEndMs><OffsetStartMs>8130</OffsetStartMs><VoiceType>0</VoiceType><Word>土</Word></Words><Words><OffsetEndMs>8850</OffsetEndMs><OffsetStartMs>8130</OffsetStartMs><VoiceType>1</VoiceType><Word>。</Word></Words><Words><OffsetEndMs>9915</OffsetEndMs><OffsetStartMs>8850</OffsetStartMs><VoiceType>0</VoiceType><Word>谁知</Word></Words><Words><OffsetEndMs>11130</OffsetEndMs><OffsetStartMs>9915</OffsetStartMs><VoiceType>0</VoiceType><Word>盘中餐</Word></Words><Words><OffsetEndMs>11130</OffsetEndMs><OffsetStartMs>9915</OffsetStartMs><VoiceType>1</VoiceType><Word>,</Word></Words><Words><OffsetEndMs>12045</OffsetEndMs><OffsetStartMs>11130</OffsetStartMs><VoiceType>0</VoiceType><Word>粒粒</Word></Words><Words><OffsetEndMs>12540</OffsetEndMs><OffsetStartMs>12045</OffsetStartMs><VoiceType>0</VoiceType><Word>皆</Word></Words><Words><OffsetEndMs>14745</OffsetEndMs><OffsetStartMs>12540</OffsetStartMs><VoiceType>0</VoiceType><Word>辛苦</Word></Words><Words><OffsetEndMs>14745</OffsetEndMs><OffsetStartMs>12540</OffsetStartMs><VoiceType>1</VoiceType><Word>。</Word></Words><WordsNum>22</WordsNum></ResultDetail></SpeechRecognitionResult><TemplateId>t14aea553bb55c468b963fafa472afc538</TemplateId><TemplateName>test</TemplateName></Operation></JobsDetail></Response>
案例 2:通过工作流触发的任务回调
<Response><EventName>TaskFinish</EventName><JobsDetail><Code>Success</Code><CreationTime>2022-09-02T10:25:38+0800</CreationTime><EndTime>2022-09-02T10:25:46+0800</EndTime><Input><BucketId>test-1234567890</BucketId><Object>minnong.mp3</Object><Region>ap-chongqing</Region><CosHeaders><Key>Content-Type</Key><Value>Audio/mp3</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>s886c0a7c2a6611ed847a618901112dcf</JobId><Message/><Operation><UserData>This is my SpeechRecognition job.</UserData><JobLevel>0</JobLevel><Output><Bucket>test-1234567890</Bucket><Object>/example.txt</Object><Region>ap-chongqing</Region></Output><SpeechRecognitionResult><AudioTime>19.7124</AudioTime><DetailObjectName>/example.txt.detail</DetailObjectName><ObjectName>/example.txt</ObjectName><Result>[0:3.320,0:19.712] 悯农,李绅,锄禾日当午,汗滴禾下土。谁知盘中餐,粒粒皆辛苦。</Result><ResultDetail><EndMs>19712</EndMs><FinalSentence>悯农,李绅,锄禾日当午,汗滴禾下土。谁知盘中餐,粒粒皆辛苦。</FinalSentence><SliceSentence>悯 农 , 李 绅 , 锄禾 日 当午 , 汗滴 禾 下 土 。 谁知 盘中餐 , 粒粒 皆 辛苦 。</SliceSentence><SpeakerId>0</SpeakerId><SpeechSpeed>2.4</SpeechSpeed><StartMs>3320</StartMs><Words><OffsetEndMs>2190</OffsetEndMs><OffsetStartMs>0</OffsetStartMs><VoiceType>0</VoiceType><Word>悯</Word></Words><Words><OffsetEndMs>2625</OffsetEndMs><OffsetStartMs>2190</OffsetStartMs><VoiceType>0</VoiceType><Word>农</Word></Words><Words><OffsetEndMs>2625</OffsetEndMs><OffsetStartMs>2190</OffsetStartMs><VoiceType>1</VoiceType><Word>,</Word></Words><Words><OffsetEndMs>3060</OffsetEndMs><OffsetStartMs>2625</OffsetStartMs><VoiceType>0</VoiceType><Word>李</Word></Words><Words><OffsetEndMs>3825</OffsetEndMs><OffsetStartMs>3060</OffsetStartMs><VoiceType>0</VoiceType><Word>绅</Word></Words><Words><OffsetEndMs>3825</OffsetEndMs><OffsetStartMs>3060</OffsetStartMs><VoiceType>1</VoiceType><Word>,</Word></Words><Words><OffsetEndMs>5040</OffsetEndMs><OffsetStartMs>3825</OffsetStartMs><VoiceType>0</VoiceType><Word>锄禾</Word></Words><Words><OffsetEndMs>5475</OffsetEndMs><OffsetStartMs>5040</OffsetStartMs><VoiceType>0</VoiceType><Word>日</Word></Words><Words><OffsetEndMs>6390</OffsetEndMs><OffsetStartMs>5475</OffsetStartMs><VoiceType>0</VoiceType><Word>当午</Word></Words><Words><OffsetEndMs>6390</OffsetEndMs><OffsetStartMs>5475</OffsetStartMs><VoiceType>1</VoiceType><Word>,</Word></Words><Words><OffsetEndMs>7365</OffsetEndMs><OffsetStartMs>6390</OffsetStartMs><VoiceType>0</VoiceType><Word>汗滴</Word></Words><Words><OffsetEndMs>7755</OffsetEndMs><OffsetStartMs>7365</OffsetStartMs><VoiceType>0</VoiceType><Word>禾</Word></Words><Words><OffsetEndMs>8130</OffsetEndMs><OffsetStartMs>7755</OffsetStartMs><VoiceType>0</VoiceType><Word>下</Word></Words><Words><OffsetEndMs>8850</OffsetEndMs><OffsetStartMs>8130</OffsetStartMs><VoiceType>0</VoiceType><Word>土</Word></Words><Words><OffsetEndMs>8850</OffsetEndMs><OffsetStartMs>8130</OffsetStartMs><VoiceType>1</VoiceType><Word>。</Word></Words><Words><OffsetEndMs>9915</OffsetEndMs><OffsetStartMs>8850</OffsetStartMs><VoiceType>0</VoiceType><Word>谁知</Word></Words><Words><OffsetEndMs>11130</OffsetEndMs><OffsetStartMs>9915</OffsetStartMs><VoiceType>0</VoiceType><Word>盘中餐</Word></Words><Words><OffsetEndMs>11130</OffsetEndMs><OffsetStartMs>9915</OffsetStartMs><VoiceType>1</VoiceType><Word>,</Word></Words><Words><OffsetEndMs>12045</OffsetEndMs><OffsetStartMs>11130</OffsetStartMs><VoiceType>0</VoiceType><Word>粒粒</Word></Words><Words><OffsetEndMs>12540</OffsetEndMs><OffsetStartMs>12045</OffsetStartMs><VoiceType>0</VoiceType><Word>皆</Word></Words><Words><OffsetEndMs>14745</OffsetEndMs><OffsetStartMs>12540</OffsetStartMs><VoiceType>0</VoiceType><Word>辛苦</Word></Words><Words><OffsetEndMs>14745</OffsetEndMs><OffsetStartMs>12540</OffsetStartMs><VoiceType>1</VoiceType><Word>。</Word></Words><WordsNum>22</WordsNum></ResultDetail></SpeechRecognitionResult><TemplateId>t14aea553bb55c468b963fafa472afc538</TemplateId><TemplateName>test</TemplateName></Operation><QueueId>p2242ab62c7c94486915508540933a2c6</QueueId><StartTime>2022-09-02T10:25:39+0800</StartTime><State>Success</State><Tag>SpeechRecognition</Tag><Workflow><Name>SpeechRecognition_1581665960537</Name><RunId>ic90edd59f84f11ec9d4f525400a3c59f</RunId><WorkflowId>web6ac56c1ef54dbfa44d7f4103203be9</WorkflowId><WorkflowName>workflow-test</WorkflowName></Workflow></JobsDetail></Response>
案例 3:通过工作流触发的任务回调, 格式为 JSON
{"EventName": "TaskFinish","JobsDetail": [{"Code": "Success","CreationTime": "2022-09-02T10:25:38+0800","EndTime": "2022-09-02T10:25:46+0800","Input": {"BucketId": "test-1234567890","Object": "minnong.mp3","Region": "ap-chongqing","CosHeaders": [{"Key": "Content-Type","Value": "Audio/mp3"},{"Key": "x-cos-request-id","Value": "NjJiZDYwYTFfNjUzYTYyNjRfZjEwZl8xMmZhYzY5"},{"Key": "EventName","Value": "cos:ObjectCreated:Put"},{"Key": "Size","Value": "1424687"}]},"JobId": "s886c0a7c2a6611ed847a618901112dcf","Operation": {"UserData": "This is my SpeechRecognition job.","JobLevel": "0","Output": {"Bucket": "test-1234567890","Object": "/example.txt","Region": "ap-chongqing"},"SpeechRecognitionResult": {"AudioTime": "19.7124","DetailObjectName": "/example.txt.detail","ObjectName": "/example.txt","Result": "[0:3.320,0:19.712] 悯农,李绅,锄禾日当午,汗滴禾下土。谁知盘中餐,粒粒皆辛苦。","ResultDetail": {"EndMs": "19712","FinalSentence": "悯农,李绅,锄禾日当午,汗滴禾下土。谁知盘中餐,粒粒皆辛苦。","SliceSentence": "悯 农 , 李 绅 , 锄禾 日 当午 , 汗滴 禾 下 土 。 谁知 盘中餐 , 粒粒 皆 辛苦 。","SpeakerId": "0","SpeechSpeed": "2.4","StartMs": "3320","Words": [{"OffsetEndMs": "2190","OffsetStartMs": "0","VoiceType": "0","Word": "悯"},{"OffsetEndMs": "2625","OffsetStartMs": "2190","VoiceType": "0","Word": "农"},{"OffsetEndMs": "2625","OffsetStartMs": "2190","VoiceType": "1","Word": ","},{"OffsetEndMs": "3060","OffsetStartMs": "2625","VoiceType": "0","Word": "李"},{"OffsetEndMs": "3825","OffsetStartMs": "3060","VoiceType": "0","Word": "绅"},{"OffsetEndMs": "3825","OffsetStartMs": "3060","VoiceType": "1","Word": ","},{"OffsetEndMs": "5040","OffsetStartMs": "3825","VoiceType": "0","Word": "锄禾"},{"OffsetEndMs": "5475","OffsetStartMs": "5040","VoiceType": "0","Word": "日"},{"OffsetEndMs": "6390","OffsetStartMs": "5475","VoiceType": "0","Word": "当午"},{"OffsetEndMs": "6390","OffsetStartMs": "5475","VoiceType": "1","Word": ","},{"OffsetEndMs": "7365","OffsetStartMs": "6390","VoiceType": "0","Word": "汗滴"},{"OffsetEndMs": "7755","OffsetStartMs": "7365","VoiceType": "0","Word": "禾"},{"OffsetEndMs": "8130","OffsetStartMs": "7755","VoiceType": "0","Word": "下"},{"OffsetEndMs": "8850","OffsetStartMs": "8130","VoiceType": "0","Word": "土"},{"OffsetEndMs": "8850","OffsetStartMs": "8130","VoiceType": "1","Word": "。"},{"OffsetEndMs": "9915","OffsetStartMs": "8850","VoiceType": "0","Word": "谁知"},{"OffsetEndMs": "11130","OffsetStartMs": "9915","VoiceType": "0","Word": "盘中餐"},{"OffsetEndMs": "11130","OffsetStartMs": "9915","VoiceType": "1","Word": ","},{"OffsetEndMs": "12045","OffsetStartMs": "11130","VoiceType": "0","Word": "粒粒"},{"OffsetEndMs": "12540","OffsetStartMs": "12045","VoiceType": "0","Word": "皆"},{"OffsetEndMs": "14745","OffsetStartMs": "12540","VoiceType": "0","Word": "辛苦"},{"OffsetEndMs": "14745","OffsetStartMs": "12540","VoiceType": "1","Word": "。"}],"WordsNum": "22"}},"TemplateId": "t14aea553bb55c468b963fafa472afc538","TemplateName": "test"},"QueueId": "p2242ab62c7c94486915508540933a2c6","StartTime": "2022-09-02T10:25:39+0800","State": "Success","Tag": "SpeechRecognition","Workflow": {"Name": "SpeechRecognition_1581665960537","RunId": "ic90edd59f84f11ec9d4f525400a3c59f","WorkflowId": "web6ac56c1ef54dbfa44d7f4103203be9","WorkflowName": "workflow-test"}}]}