REST API export
Installation
REST API export extension is provided and maintained by Rossum.ai in the form of webhook. To start using it, follow these steps:
- Login to your Rossum account.
- Navigate to Extensions → My extensions.
- Click on Create extension.
- Fill the following fields:
- Name:
REST API export
- Trigger events:
Export
- Extension type:
Webhook
- URL (see below)
- Name:
- Click Create the webhook.
- Fill in the
Configuration
field (see Configuration examples for some examples).
Webhook URL endpoints:
Environment | Webhook URL |
---|---|
EU1 Ireland | https://elis.rest-api-export.rossum-ext.app/ |
EU2 Frankfurt | https://shared-eu2.rest-api-export.rossum-ext.app/ |
US east coast | https://us.rest-api-export.rossum-ext.app/ |
Japan Tokyo | https://shared-jp.rest-api-export.rossum-ext.app/ |
Basic usage
We're still working on this part and would love to hear your thoughts! Feel free to share your feedback or submit a pull request. Thank you! 🙏
Available configuration options
We're still working on this part and would love to hear your thoughts! Feel free to share your feedback or submit a pull request. Thank you! 🙏
Configuration examples
This extension currently expects file to be generated using Custom format templating extension.
Simple REST API call
{
"export_reference_key": "export_annotation_to_csv",
"request": {
"url": "https://webhook.site/XXX-ZZZ",
"method": "POST",
"headers": {
"Content-Type": "text/plain"
},
"content": "#{file_content}"
}
}
REST API call with OAuth2
The request can be extended to use OAuth2:
{
"export_reference_key": "export_annotation_to_csv",
"auth": {
"url": "http://custom.url/token",
"method": "POST",
"data": {
"username": "your_username",
"password": "{secret.password}"
}
},
"request": {
"url": "https://webhook.site/XXX-ZZZ",
"method": "POST",
"headers": {
"Content-Type": "text/plain",
"Authorization": "Bearer {secret.access_token}"
},
"content": "#{file_content}"
}
}
The access_token
is automatically retrieved using given credentials and saved to hook secrets for later reuse. A more complex OAuth2 setup:
{
"export_reference_key": "export_annotation_to_csv",
"request": {
"url": "https://webhook.site/XXX-ZZZ",
"method": "POST",
"headers": {
"Content-Type": "text/json"
},
"content": "#{file_content}"
},
"auth": {
"url": "http://custom.url/token",
"method": "POST",
"data": {
"scope": "invoice.create invoice.read",
"client_id": "{secret.client_id}",
"grant_type": "client_credentials",
"client_secret": "{secret.client_secret}"
},
"headers": {
"Content-Type": "application/x-www-form-urlencoded"
}
},
"condition": "@{api_gate}",
"response_headers_reference_key": "export_reply_headers",
"response_payload_reference_key": "export_reply_payload"
}
Please note the response_headers_reference_key
and response_payload_reference_key
. The first stores the headers of the reply (with added status_code
), the later stores the full body from the reply. Both of them can be retrieved via API (the link to the received data is stored with the desired key in annotation's metadata). There is an extension prepared for you, that will extract key values (Extract data).
For original file use #{original_file}
.
You can use condition that controls whether the export is triggered. If the referred field is non-empty (!= ""
) it will start export and skip it if it is empty (== ""
).