forked from r-lib/httr
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPUT.Rd
69 lines (60 loc) · 2.58 KB
/
PUT.Rd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
% Generated by roxygen2 (4.0.2): do not edit by hand
\name{PUT}
\alias{PUT}
\title{Send PUT request to server.}
\usage{
PUT(url = NULL, config = list(), ..., body = NULL,
encode = c("multipart", "form", "json"), multipart = TRUE,
handle = NULL)
}
\arguments{
\item{url}{the url of the page to retrieve}
\item{config}{Additional configuration settings such as http
authentication (\code{\link{authenticate}}), additional headers
(\code{\link{add_headers}}), cookies (\code{\link{set_cookies}}) etc.
See \code{\link{config}} for full details and list of helpers.}
\item{...}{Further named parameters, such as \code{query}, \code{path}, etc,
passed on to \code{\link{modify_url}}. Unnamed parameters will be combined
with \code{\link{config}}.}
\item{body}{One of the following:
\itemize{
\item \code{FALSE}: No body
\item \code{NULL}: An empty body
\item \code{""}: A length 0 body
\item \code{upload_file("path/")}: The contents of a file. The mime
type will be guessed from the extension, or can be supplied explicitly
as the second argument to \code{upload_file()}
\item A character or raw vector: sent as is in body. Use
\code{\link{content_type}} to tell the server what sort of data
you are sending.
\item A named list: See details for encode.
}}
\item{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
\code{\link{upload_file}}. For "form", elements are coerced to strings
and escaped, use \code{I()} to prevent double-escaping.}
\item{multipart}{Deprecated. \code{TRUE} = \code{encode = "multipart"},
\code{FALSE} = {encode = "form"}.
Files can not be uploaded when \code{FALSE}.}
\item{handle}{The handle to use with this request. If not
supplied, will be retrieved and reused from the \code{\link{handle_pool}}
based on the scheme, hostname and port of the url. By default \pkg{httr}
requests to the same scheme/host/port combo. This substantially reduces
connection time, and ensures that cookies are maintained over multiple
requests to the same host. See \code{\link{handle_pool}} for more
details.}
}
\description{
Send PUT request to server.
}
\examples{
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")
}