httr (version 1.1.0)

PUT: Send PUT request to server.

Description

Send PUT request to server.

Usage

PUT(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 the same

See Also

Other http methods: BROWSE, DELETE, GET, HEAD, PATCH, POST, VERB

Examples

Run this code
POST("http://httpbin.org/put")
PUT("http://httpbin.org/put")

b2 <- "http://httpbin.org/put"
PUT(b2, body = "A simple text string")
PUT(b2, body = list(x = "A simple text string"))
PUT(b2, body = list(y = upload_file(system.file("CITATION"))))
PUT(b2, body = list(x = "A simple text string"), encode = "json")

Run the code above in your browser using DataCamp Workspace