Teach the template from a loan document
const url = 'http://localhost:8080/v1/extraction-templates/corrections';const options = { method: 'POST', headers: {'Content-Type': 'application/json'}, body: '{"documentId":"2489E9AD-2EE2-8E00-8EC9-32D5F69181C0","pageNo":1,"box":{"x":1,"y":1,"w":1,"h":1},"field":"example"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url http://localhost:8080/v1/extraction-templates/corrections \ --header 'Content-Type: application/json' \ --data '{ "documentId": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "pageNo": 1, "box": { "x": 1, "y": 1, "w": 1, "h": 1 }, "field": "example" }'Takes documentId, pageNo, box and field: reads the box on that loan document, turns it into the region rule for that field of the document’s type, replaces any earlier rule for the field, saves the overlay, and returns the rule with the value it reads on this document. The loan itself is unchanged until it is reprocessed. 400 for an unclassified document or an empty box. Administrators only.
Request Bodyrequired
Section titled “Request Bodyrequired”Body of POST /v1/extraction-templates/corrections: a box drawn on a loan document’s page, naming the field it holds.
object
Examplegenerated
{ "documentId": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "pageNo": 1, "box": { "x": 1, "y": 1, "w": 1, "h": 1 }, "field": "example"}Responses
Section titled “Responses”OK
A correction applied: the document type it taught, the rule saved for it, the value that rule reads on this document, and the overlay as saved.
object
One declarative extraction rule; the serialised form of the engine’s rule types. string TemplateRuleSpec.Type is one of
TemplateRuleTypes; string? TemplateRuleSpec.Pattern/string? TemplateRuleSpec.ValuePattern are.NET regexes and a
sentence pattern must capture the value as (?<v>…). A region rule; the studio’s
point-and-name mapping; carries the int? TemplateRuleSpec.Page and BoundingBox? TemplateRuleSpec.Box that was drawn (page fractions,
origin top-left) and the RegionAnchor? TemplateRuleSpec.Anchor label the engine follows when the page shifts.
object
A label the engine can find again near a region; its printed text and where it sat on the sample (page fractions); so the region follows the label when a scan is offset or a form re-flows.
object
Page-relative box: fractions of page width/height, origin top-left, so it survives any render scale.
object
object
Example
{ "rule": { "requireBold": true }}