old_2014_version_of_archivist/R/getBitLy.R

getBitLy <- function(url, mytoken, escape=TRUE) {
  if (escape)
      url <- curlEscape(url)
  resp <- GET(paste0(
    "https://api-ssl.bitly.com/v3/shorten?access_token=", mytoken, 
    "&longUrl=",url))
  resparsed <- fromJSON(rawToChar(resp$content))
  list(status = resparsed$status_txt,
                bitly = resparsed$data$url)
}
pbiecek/archivist2 documentation built on May 24, 2019, 10:36 p.m.