POST

0th

Percentile

POST file to a server.

POST file to a server.

Usage
POST(url = NULL, config = list(), ..., body = NULL,
  encode = c("multipart", "form", "json"), multipart = TRUE,
  handle = NULL)
Arguments
url
the url of the page to retrieve
config
Additional configuration settings such as http authentication (authenticate), additional headers (add_headers), cookies (
...
Further named parameters, such as query, path, etc, passed on to modify_url. Unnamed parameters will be combined with config.
body
One of the following:
  • FALSE: No body
  • NULL: An empty body
  • "": A length 0 body
  • upload_file("path/"): The contents of a file. The mime type will be guessed from the exte
encode
If the body is a named list, how should it be encoded? Can be one of form (application/x-www-form-urlencoded), multipart, (multipart/form-data), or json (application/json).

For "multipart", list elements can be strings or objects created by

multipart
Deprecated. TRUE = encode = "multipart", FALSE = {encode = "form"}. Files can not be uploaded when FALSE.
handle
The handle to use with this request. If not supplied, will be retrieved and reused from the handle_pool based on the scheme, hostname and port of the url. By default httr requests to th
Aliases
  • POST
Examples
b2 <- "http://httpbin.org/post"
POST(b2, body = "A simple text string")
POST(b2, body = list(x = "A simple text string"))
POST(b2, body = list(y = upload_file(system.file("CITATION"))))
POST(b2, body = list(x = "A simple text string"), encode = "json")

# Various types of empty body:
POST(b2, body = NULL, verbose())
POST(b2, body = FALSE, verbose())
POST(b2, body = "", verbose())
Documentation reproduced from package httr, version 0.6.1, License: MIT + file LICENSE

Community examples

Looks like there are no examples yet.