有奖捉虫:行业应用 & 管理与支持文档专题 HOT

功能说明

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

回调内容

任务完成后,系统会向您设置的回调地址发送回调内容,包含完整节点数据的内容展示如下:
<Response>
<EventName>TaskFinish</EventName>
<JobsDetail>
<Code>Success</Code>
<CreationTime>2023-11-25T08:47:39+0800</CreationTime>
<EndTime>2023-11-25T08:47:40+0800</EndTime>
<Input>
<BucketId>test-1234567890</BucketId>
<Object>pic/ocr1.png</Object>
<Region>ap-chongqing</Region>
</Input>
<JobId>a3c193f288b2c11eeb60f39de2f86f409</JobId>
<Message/>
<Operation>
<Detection>
<Angel>0</Angel>
<Language/>
<PdfPageSize>0</PdfPageSize>
<TextDetections>
<Confidence>98</Confidence>
<DetectedText>锄禾日当午</DetectedText>
<ItemPolygon>
<Height>35</Height>
<Width>176</Width>
<X>40</X>
<Y>24</Y>
</ItemPolygon>
<Polygon>
<X>40</X>
<Y>24</Y>
</Polygon>
<Polygon>
<X>215</X>
<Y>24</Y>
</Polygon>
<Polygon>
<X>215</X>
<Y>58</Y>
</Polygon>
<Polygon>
<X>40</X>
<Y>58</Y>
</Polygon>
<WordPolygon/>
<Words>
<Character/>
<Confidence>0</Confidence>
<WordCoordPoint/>
</Words>
</TextDetections>
<TextDetections>
<Confidence>91</Confidence>
<DetectedText>汗滴禾下土</DetectedText>
<ItemPolygon>
<Height>30</Height>
<Width>164</Width>
<X>40</X>
<Y>81</Y>
</ItemPolygon>
<Polygon>
<X>40</X>
<Y>81</Y>
</Polygon>
<Polygon>
<X>203</X>
<Y>81</Y>
</Polygon>
<Polygon>
<X>203</X>
<Y>110</Y>
</Polygon>
<Polygon>
<X>40</X>
<Y>110</Y>
</Polygon>
<WordPolygon/>
<Words>
<Character/>
<Confidence>0</Confidence>
<WordCoordPoint/>
</Words>
</TextDetections>
<TextDetections>
<Confidence>97</Confidence>
<DetectedText>谁知盘中餐</DetectedText>
<ItemPolygon>
<Height>33</Height>
<Width>164</Width>
<X>40</X>
<Y>129</Y>
</ItemPolygon>
<Polygon>
<X>40</X>
<Y>129</Y>
</Polygon>
<Polygon>
<X>203</X>
<Y>129</Y>
</Polygon>
<Polygon>
<X>203</X>
<Y>161</Y>
</Polygon>
<Polygon>
<X>40</X>
<Y>161</Y>
</Polygon>
<WordPolygon/>
<Words>
<Character/>
<Confidence>0</Confidence>
<WordCoordPoint/>
</Words>
</TextDetections>
<TextDetections>
<Confidence>99</Confidence>
<DetectedText>粒粒皆辛苦</DetectedText>
<ItemPolygon>
<Height>34</Height>
<Width>165</Width>
<X>39</X>
<Y>181</Y>
</ItemPolygon>
<Polygon>
<X>39</X>
<Y>181</Y>
</Polygon>
<Polygon>
<X>203</X>
<Y>181</Y>
</Polygon>
<Polygon>
<X>203</X>
<Y>214</Y>
</Polygon>
<Polygon>
<X>39</X>
<Y>214</Y>
</Polygon>
<WordPolygon/>
<Words>
<Character/>
<Confidence>0</Confidence>
<WordCoordPoint/>
</Words>
</TextDetections>
</Detection>
<JobLevel>0</JobLevel>
<TemplateId>t1a545cd125ea04ec7a3cd455065d601cc</TemplateId>
<TemplateName>ImageOCR-34</TemplateName>
</Operation>
<QueueId>pcaffdc4229a543b296b10b22586a1e57</QueueId>
<StartTime>2023-11-25T08:47:40+0800</StartTime>
<State>Success</State>
<Tag>ImageOCR</Tag>
</JobsDetail>
</Response>
具体的数据内容如下:
节点名称(关键字)
父节点
描述
类型
Response
保存结果的容器
Container
Container 节点 Response 的内容:
节点名称(关键字)
父节点
描述
类型
EventName
Response
固定值,为 TaskFinish
String
JobsDetail
Response
同提交OCR任务接口中的 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:通过任务接口触发的任务回调,格式为 XML

<Response>
<EventName>TaskFinish</EventName>
<JobsDetail>
<Code>Success</Code>
<CreationTime>2023-11-25T08:47:39+0800</CreationTime>
<EndTime>2023-11-25T08:47:40+0800</EndTime>
<Input>
<BucketId>test-1234567890</BucketId>
<Object>pic/ocr1.png</Object>
<Region>ap-chongqing</Region>
</Input>
<JobId>a3c193f288b2c11eeb60f39de2f86f409</JobId>
<Message/>
<Operation>
<Detection>
<Angel>0</Angel>
<Language/>
<PdfPageSize>0</PdfPageSize>
<TextDetections>
<Confidence>98</Confidence>
<DetectedText>锄禾日当午</DetectedText>
<ItemPolygon>
<Height>35</Height>
<Width>176</Width>
<X>40</X>
<Y>24</Y>
</ItemPolygon>
<Polygon>
<X>40</X>
<Y>24</Y>
</Polygon>
<Polygon>
<X>215</X>
<Y>24</Y>
</Polygon>
<Polygon>
<X>215</X>
<Y>58</Y>
</Polygon>
<Polygon>
<X>40</X>
<Y>58</Y>
</Polygon>
<WordPolygon/>
<Words>
<Character/>
<Confidence>0</Confidence>
<WordCoordPoint/>
</Words>
</TextDetections>
<TextDetections>
<Confidence>91</Confidence>
<DetectedText>汗滴禾下土</DetectedText>
<ItemPolygon>
<Height>30</Height>
<Width>164</Width>
<X>40</X>
<Y>81</Y>
</ItemPolygon>
<Polygon>
<X>40</X>
<Y>81</Y>
</Polygon>
<Polygon>
<X>203</X>
<Y>81</Y>
</Polygon>
<Polygon>
<X>203</X>
<Y>110</Y>
</Polygon>
<Polygon>
<X>40</X>
<Y>110</Y>
</Polygon>
<WordPolygon/>
<Words>
<Character/>
<Confidence>0</Confidence>
<WordCoordPoint/>
</Words>
</TextDetections>
<TextDetections>
<Confidence>97</Confidence>
<DetectedText>谁知盘中餐</DetectedText>
<ItemPolygon>
<Height>33</Height>
<Width>164</Width>
<X>40</X>
<Y>129</Y>
</ItemPolygon>
<Polygon>
<X>40</X>
<Y>129</Y>
</Polygon>
<Polygon>
<X>203</X>
<Y>129</Y>
</Polygon>
<Polygon>
<X>203</X>
<Y>161</Y>
</Polygon>
<Polygon>
<X>40</X>
<Y>161</Y>
</Polygon>
<WordPolygon/>
<Words>
<Character/>
<Confidence>0</Confidence>
<WordCoordPoint/>
</Words>
</TextDetections>
<TextDetections>
<Confidence>99</Confidence>
<DetectedText>粒粒皆辛苦</DetectedText>
<ItemPolygon>
<Height>34</Height>
<Width>165</Width>
<X>39</X>
<Y>181</Y>
</ItemPolygon>
<Polygon>
<X>39</X>
<Y>181</Y>
</Polygon>
<Polygon>
<X>203</X>
<Y>181</Y>
</Polygon>
<Polygon>
<X>203</X>
<Y>214</Y>
</Polygon>
<Polygon>
<X>39</X>
<Y>214</Y>
</Polygon>
<WordPolygon/>
<Words>
<Character/>
<Confidence>0</Confidence>
<WordCoordPoint/>
</Words>
</TextDetections>
</Detection>
<JobLevel>0</JobLevel>
<TemplateId>t1a545cd125ea04ec7a3cd455065d601cc</TemplateId>
<TemplateName>ImageOCR-34</TemplateName>
</Operation>
<QueueId>pcaffdc4229a543b296b10b22586a1e57</QueueId>
<StartTime>2023-11-25T08:47:40+0800</StartTime>
<State>Success</State>
<Tag>ImageOCR</Tag>
</JobsDetail>
</Response>

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

{
"Response": {
"EventName": "TaskFinish",
"JobsDetail": [{
"Code": "Success",
"CreationTime": "2023-11-25T08:47:39+0800",
"EndTime": "2023-11-25T08:47:40+0800",
"Input": {
"BucketId": "test-1234567890",
"Object": "pic/ocr1.png",
"Region": "ap-chongqing"
},
"JobId": "a3c193f288b2c11eeb60f39de2f86f409",
"Operation": {
"Detection": {
"Angel": "0",
"PdfPageSize": "0",
"Language": "",
"TextDetections": [{
"Confidence": 98,
"DetectedText": "锄禾日当午",
"ItemPolygon": [{
"Height": 35,
"Width": 176,
"X": 40,
"Y": 24
}],
"Polygon": [{
"X": 40,
"Y": 24
},
{
"X": 215,
"Y": 24
},
{
"X": 215,
"Y": 58
},
{
"X": 40,
"Y": 58
}
],
"Words": [{
"Confidence": 0
}]
},
{
"Confidence": 91,
"DetectedText": "汗滴禾下土",
"ItemPolygon": [{
"Height": 30,
"Width": 164,
"X": 40,
"Y": 81
}],
"Polygon": [{
"X": 40,
"Y": 81
},
{
"X": 203,
"Y": 81
},
{
"X": 203,
"Y": 110
},
{
"X": 40,
"Y": 110
}
],
"Words": [{
"Confidence": 0
}]
},
{
"Confidence": 97,
"DetectedText": "谁知盘中餐",
"ItemPolygon": [{
"Height": 33,
"Width": 164,
"X": 40,
"Y": 129
}],
"Polygon": [{
"X": 40,
"Y": 129
},
{
"X": 203,
"Y": 129
},
{
"X": 203,
"Y": 161
},
{
"X": 40,
"Y": 161
}
],
"Words": [{
"Confidence": 0
}]
},
{
"Confidence": 99,
"DetectedText": "粒粒皆辛苦",
"ItemPolygon": [{
"Height": 34,
"Width": 165,
"X": 39,
"Y": 181
}],
"Polygon": [{
"X": 39,
"Y": 181
},
{
"X": 203,
"Y": 181
},
{
"X": 203,
"Y": 214
},
{
"X": 39,
"Y": 214
}
],
"Words": [{
"Confidence": 0
}]
}
]
},
"JobLevel": 0,
"TemplateId": "t1a545cd125ea04ec7a3cd455065d601cc",
"TemplateName": "ImageOCR-34"
},
"QueueId": "pcaffdc4229a543b296b10b22586a1e57",
"StartTime": "2023-11-25T08:47:40+0800",
"State": "Success",
"Tag": "ImageOCR"
}]
}
}