This R language code 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.
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 code is designed to run using the R Project language used for statistics and data science.
library("httr") library("XML") username <- "[email protected]" password <- "yourpassword" queue_id <- 12345 date_from <- Sys.Date() - 1 date_to <- Sys.Date() login_url <- "https://api.elis.rossum.ai/v1/auth/login" queue_url <- paste("https://api.elis.rossum.ai/v1/queues/", queue_id, "/export", sep = "") response <- POST( login_url, add_headers("Content-Type" = "application/json"), body = list("username" = username, "password" = password), encode = "json" ) token <- paste("token", content(response)$key) response <- GET( queue_url, query = list(format = "xml", exported_at_after = date_from, exported_at_before = date_to, page_size = 100), add_headers("Authorization" = token) ) print(XML::xmlParse(content(response)))
This example will export at most 100 documents. To export more documents, you need to modify the code 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 over 2 years ago