BASH for Exporting Data from Rossum API
This Bash script shows how to download XML data captured in a given Rossum queue for the previous calendar day.
This Bash script shows how to download XML data captured in a given queue for the previous calendar day – as part of the regular export routine. Update the parameters at the beginning based on your scenario.
#!/usr/bin/env bash
# Simple script to login and export data from Rossum.
# Required tools: curl
[email protected]
PASSWORD=EiRu4ohgUo1Pho0r
QUEUE_ID=28
curl -u "$USERNAME:$PASSWORD" "https://example.rossum.app/api/v1/queues/$QUEUE_ID/export?format=xml&status=exported&exported_at_after=$(date -d '1 day ago' +%F)&exported_at_before=$(date +%F)&page=1&page_size=100"
To save the results to a file, use the shell redirect, for example: ./example.sh >file.xml
will store the data in file.xml
in your current directory.
The export API is more powerful - you can filter by different criteria or download the data e.g. as a JSON instead - see the full docs.
This example will export at most 100 documents. To export more documents, you need to modify the code to download multiple pages one by one, until it reaches the page count (or it can simply stop when an empty set of results is finally downloaded).
Updated about 1 year ago