R/track_progress.R

#' Track Progress of a Job
#' 
#' Check what percentage of the job is digitized
#' 
#' @param job_id ID for the job (which you get from related_job_id field of submit_batch)
#' 
#' @export
#' 
#' @references \url{https://shreddr.captricity.com/developer/}
#' 
#' @examples \dontrun{
#' track_progress("job_id")
#' }

track_progress <- function(job_id = "") {

  captr_CHECKAUTH()

  if ( is.null(job_id) | identical(job_id, "")) stop("Provide a Valid Job ID.")

  h <- new_handle()
  handle_setopt(h,  customrequest = "GET")
  handle_setheaders(h, "Captricity-API-Token" = Sys.getenv("CaptricityToken"))

  tag_con  <- curl_fetch_memory(paste0("https://shreddr.captricity.com/api/v1/job/", job_id), handle = h)
  tag    <- fromJSON(rawToChar(tag_con$content))

  tag
}

Try the captr package in your browser

Any scripts or data that you put into this service are public.

captr documentation built on May 2, 2019, 3:26 p.m.