Parse by Template

Introduction

This REST API provides the functionality to extract data from documents. This method parses document content by a user-generated template.

The template can be provided as an object or storage path. For protected documents, it is also required to provide a password.

The table below contains the full list of properties that can be specified when parsing documents by a template.

NameDescriptionComment
FileInfo.FilePathThe path of the document, located in the storage.Required.
FileInfo.StorageNameStorage nameCould be omitted for default storage.
FileInfo.PasswordThe password to open fileIt should be specified only for password-protected documents.
ContainerItemInfo.RelativePathThe relative path of the container.Should be specified only for container files like ZIP archives, emails or PDF portfolios.
ContainerItemInfo.PasswordPassword for processing password-protected container items.It should be specified only for password-protected container items.
TemplatePathThe path of the file, located in the storage, which contains a user-generated template to parse data. It is used when the template parameter is not provided.The template must be provided by this field or by Template.
TemplateUser-generated template object to extract metadata from the document.Template must be provided by this field or by TemplatePath.

Template

{{id name#“TemplateParametersTable”/}}

NameDescriptionComment
Template.FieldsTemplate fields.Required if Template. Tables are not provided.
Field.FieldNameA unique template field name.Required.
Field.PageIndexThe page index.An integer value that represents the index of the page where the template item is located; null if the template item is located on any page.
FieldPosition. FieldPositionTypeProvides a template field position.Possible values are: “Fixed”, “Linked”, “Regex”. Required.
FieldPosition.RectangleA rectangular area on the page that bounds the field value.Required if “Fixed” FieldPositionType is set.
FieldPosition.RegexString expression to find a field value by a regular expression.Required if “Regex” FieldPositionType is set.
FieldPosition.MatchCaseThe value that indicates whether a text case isn’t ignored.Is used if Regex parameter is set.
FieldPosition.LinkedFieldNameThe name of the linked field.Required if “Linked” FieldPositionType is set.
FieldPosition.IsLeftLinkedThe value that indicates whether a field is searched by the left from the linked field.Is used if “Linked” FieldPositionType is set.
FieldPosition.IsRightLinkedThe value that indicates whether a field is searched by the right from the linked field.Is used if “Linked” FieldPositionType is set.
FieldPosition.IsTopLinkedThe value that indicates whether a field is searched by the top from the linked field.Is used if “Linked” FieldPositionType is set.
FieldPosition.IsBottomLinkedThe value that indicates whether a field is searched by the bottom from the linked field.Is used if “Linked” FieldPositionType is set.
FieldPosition.SearchAreaThe size of the area where a field is searched.Required if “Linked” FieldPositionType is set.
SearchArea.HeightThe height of search area.
SearchArea.WidthThe width of search area.
FieldPosition.AutoScaleThe value that indicates whether SearchArea is scaled by the linked field size.Is used if “Linked” FieldPositionType is set.
Template.TablesTemplate tables.Required if Template.Fields are not provided.
Table.FieldNameA unique template table name.Required.
Table.PageIndexThe page index.An integer value that represents the index of the page where the template item is located; null if the template item is located on any page.
Table.DetectorParametesProvides parameters for the table detection algorithms.Required if TableLayout is not provided.
DetectorParameters.MinRowCountThe minimum number of the table rows.
DetectorParameters.MinColumnCountThe minimum number of the table columns.
DetectorParameters.MinVerticalSpaceThe minimum space between the table columns.
DetectorParameters.HasMergedCellsThe value that indicates whether the table has merged cells.
DetectorParameters.RectangleThe rectangular area that contains the table.
DetectorParameters.VerticalSeparatorsThe table columns separators.
Table.TableLayoutProvides the template table layout which is used Table to define table position.Required if DetectorParameters is not provided.
TableLayout.VerticalSeparatorsThe table columns separators.
TableLayout.HorizontalSeparatorsThe table rows separators.

Rectangle

{{id name#“RectangleParametersTable”/}}

NameDescriptionComment
Rectangle.PositionThe coordinates of the upper-left corner of the rectangular area.Required if Rectangle.Coordinates is not provided.
Position.XX-coordinate of upper-left rectangle corner.
Position.YY-coordinate of upper-left rectangle corner.
Rectangle.SizeRepresents a size of rectangular area.Required if Rectangle.Coordinates is not provided.
Size.HeightThe height of rectangular area.
Size.WidthThe width of rectangular area.
Rectangle.CoordinatesCoordinates of the rectangular area edges.
Coordinates.TopThe y-coordinate of the top edge of the rectangular area.
Coordinates.RightThe x-coordinate of the right edge of the rectangular area.
Coordinates.LeftThe x-coordinate of the left edge of the rectangular area.
Coordinates.BottomThe y-coordinate of the bottom edge of the rectangular area.

Resource URI


HTTP POST ~/parse

Swagger UI lets you call this REST API directly from the browser. 

Use Cases