Development of an Application That Consumes the Flow Extension API
Once your flow extension configuration is complete, you can develop a client application that calls the APIs in the Flow extension API, as follows:
-
If a document being delivered satisfies the criteria specified in your flow extension configuration, a flow extension event is generated and added to the flow extension event queue.
-
To retrieve events from the flow extension event queue, your application calls the flowextensions/{flowExtensionID}/events endpoint:
GET {{runtime_url}}/flowextensions/{flowExtensionID}/events?count=n -
To acknowledge receipt of the event or events retrieved, your client application calls the /acknowledge endpoint. Invoking this API informs the flow extension service that the events have been successfully delivered, preventing the service from returning the same events in response to a later request to retrieve events from the flow extension event queue. Subsequent API calls for these events (for example requests to enrich the document or resume the normal flow) will not function until after the /acknowledge call.
POST {{runtime_url}}/flowextensions/action/{flowExtensionID}/events/acknowledge { <events> <event><eventId>event_id</eventId></event> </events> } -
To retrieve event data (and attachments, if desired) from a flow extension event, your client application calls the /eventdata endpoint. The exact structure of the output this API call returns is defined in your configuration file.
-
To retrieve data without downloading attachments:
GET {{runtime_url}}/flowextensions/{flowExtensionId}/events/{eventID}/eventdata -
You can use this API to download one or more attachments. The maximum size for attachments is 20 mb. To download a single attachment, call the API as follows:
GET {{runtime_url}}/flowextensions/{flowExtensionID}/events/{eventID}/eventdata/attachment?cid={attachmentID} -
To download all attachments, set the http Accept to multipart/mixed and call the API as follows:
GET {{runtime_url}}/flowextensions/{flowExtensionID}/events/{eventID}/eventdata/attachment { "Accept":"multipart/mixed" }
-
-
Optional. To enrich the intercepted document, your client application calls the /{extId}/events/{eventID} endpoint. This API lets you post a comment or attachments to the event. This API is not supported in the non-suspend flow extension use case. The maximum size for attachments is 20 mb.
POST {{runtime_url}}/{extId}/events/{eventID} { "comment":"my comment here" } -
Depending on the use case, complete the flow extension by calling one of the following APIs:
-
in the simple flow extension use case and the halt flow extension use case, you can allow the normal document flow to resume by having your client application call the /resume endpoint.
POST {{runtime_url}}/flowextensions/action/{flowExtensionID}/events/{eventID}/resume -
In the halt flow extension use case, you can complete the flow extension and reject the document, returning it to the sender in FAILED status. to do so, the client application should call the /halt endpoint:
POST {{runtime_url}}/flowextensions/action/{flowExtensionID}/events/{eventID}/halt -
In the non-suspend flow extension use case, you can indicate completion of the flow extension processing for the event by calling the /complete endpoint:
POST {{runtime_url}}/flowextensions/action/{flowExtensionID}/events/{eventID}/complete
-