R-language for Uploading Documents in Rossum API

This R code shows how to upload a document automatically using Rossum API to a particular Rossum queue.

This R example demonstrates how to upload a document using Rossum API to a particular Rossum queue. Set the options at the beginning of the code – they store your credentials, and also the identifier of the queue to upload in. You can find out the queue id by looking at your main screen URL, it is the number 12345 in https://example.rossum.app/annotations/12345.

See the reference API documentation for more details about how to use the upload API.


username <- "[email protected]"
password <- "yourpassword"
queue_id <- 12345
login_url <- "https://example.rossum.app/api/v1/auth/login"
queue_url <- paste("https://example.rossum.app/api/v1/queues/", queue_id, "/upload", sep = "")
filepath = "path/to/file"

response <- POST(
  add_headers("Content-Type" = "application/json"),
  body = list("username" = username, "password" = password),
  encode = "json"

token <- paste("token", content(response)$key)

response <- POST(
    "Authorization" = token,
    "Content-Disposition" = paste("attachment; filename=", basename(filepath), sep="")
  body = upload_file(filepath)