R/track_progress.R

Defines functions track_progress

Documented in track_progress

#' 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 30, 2017, 6:39 a.m.