R/uploadXMLFile.R

Defines functions uploadXMLFile

uploadXMLFile <- function(txt) {

    uri <- sag_uri("uploadXMLFile", token = "test")
    uri <- gsub("[?]token=test", "", uri)

    body <- sprintf("f=%s&token=%s",
                    openssl::base64_encode(utils::URLencode(txt)),
                    sg_pat())

    x <- httr::POST(uri,
                    body = body,
                    httr::content_type("application/x-www-form-urlencoded"),
                    `Content-Length` = nchar(body))
    message(httr::http_status(x)$message)
    unlist(xml2::as_list(httr::content(x)))
}

Try the icesSAG package in your browser

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

icesSAG documentation built on March 18, 2022, 6:54 p.m.