Synchronous workflows
A workflow published in synchronous mode has only one API resource to perform document analysis. It contains the results of the analysis and the operation is synchronous, so the response time experienced by the client is equal to the time necessary to carry out the analysis of the document inside the workflow plus transmission times.
Analysis resource endpoint
The API endpoint for document analysis with a synchronous workflow is:
https://host/api/v1/runtime/workflow/workflowId/action/analyze
where you have to replace:
host
with the host name or IP address of the NL Flow runtime.workflowId
with the workflow ID.
To get the actual endpoint for a workflow, access the NL Flow application and:
- Open the workflow in the Workflows view of the dashboard.
- Display identifying information.
- Copy the value of the Document analysis endpoint.
To get a verbose output in case of errors add this query string parameter to the URL:
verboseErrorOutput=true
HTTP verb
The document analysis resource must be requested with the POST
verb.
Request headers
In every request you must set the following headers:
Content-type: application/json; charset=utf-8
X-API-KEY: APIKEY
where you have to replace APIKEY
with the API key associated with your workflow.
The X-Correlation-Id
header is optional and used for troubleshooting purposes.
Its value can be any string and must be unique for each call. You can mention this value when asking for support if you get unexpected errors. Support personnel can then track your calls based on this value when examining the NL Flow API logs.
Request body
The body of document analysis requests must be an UTF-8 encoded JSON object.
In the JSON object there must be all the keys that the workflow needs to use. In the NL Flow application documentation you can find the description of the keys expected by model blocks and by processor blocks.
Each model or processor block, no matter how deep in the workflow, has access to the input JSON object keys by defining the input format, which also allows you to handle key name mismatch cases.
Response
The response body is a JSON corresponding to the workflow output.