Wrapper to make generic POST calls to SAS Viya

vPOST(
  session,
  path,
  payload,
  ...,
  query,
  fragment,
  encode = "json",
  verbose = FALSE,
  output = "json"
)

Arguments

session

viya_connection object, obtained through session function

path

character, path to the GET api endpoint

payload

list or json string, if it is a list, will be transformed in a json string using jsonlite::toJSON

...

additional parameters to be passed to httr::POST such as httr::add_headers

query

list, additional URL query parameters

fragment

string, additional URL fragment parameter url.com?query#fragment

encode

payload encoding type, to be passed to httr::POST.

verbose

logical, return print API call information

output

string, if json will return httr::fromJSON(httr::content(response, as = "text")) with etag information parsed, else if response will return a httr::response() object, if text will return content(response, as = "text")

Value

list if output = "json" default. httr::response() if output = response.

See also

httr::GET(), httr::POST(), httr::PUT(), httr::DELETE()

Other core API requests: vDELETE(), vGET(), vHEAD(), vPUT()

Examples


if (FALSE) { # \dontrun{
folders <- vGET(session,
                path = "folders/folders/")


newFolder <- vPOST(session,
                   path = paste0("folders/folders/"),
                   query = list(parentFolderUri = folders$items$parentFolderUri[1]),
                   payload = list(name = "newFolder"),
                   httr::content_type("application/json"))


deletedFolder <- vDELETE(session,
                         path = "folders/folders/",
                         resourceID = newFolder$id)

} # }