RestContainer-class {restfulr} | R Documentation |
RestContainer
Description
The RestContainer
object wraps a collection of resources with a
list-like interface. Values are stored and retrieved
using familiar accessors like [[
and [[<-
. Coercion
between external media and R objects is based on the
Media
framework.
Data access
The RestContainer
object maps familiar R list accessors to CRUD
operations on RestUri
.
-
x[] <- value
: Creates resources for the objects invalue
atx
. This is thecreate
/POST
operation. Unlike an R list, the resources are added to the collection without removing any existing resources. This inconsistency is unfortunate, so we might change this behavior in the future. -
x$name
,x[[i]]
: Reads the named element. This is theread
/GET
operation. -
x[i]
: Reads the named elements, which are returned in a list. This is the vectorizedread
/GET
operation. Unlike an R list, this is not an endomorphism, in that the return value is dropped to a list and is no longer attached to the REST interface. -
x$name <- value
,x[[i]] <- value
: Updates the named resource withvalue
. This is theupdate
/PUT
operation. -
x[i] <- value
: Updates resources atx
with the objects invalue
, a list. This is the vectorizedupdate
/PUT
operation. -
x$name <- NULL
,x[[i]] <- NULL
: Deletes the named resource. This is thedelete
/DELETE
operation.
Constructor
RestContainer(...)
: Constructs an instance based onRestUri(...)
.
Author(s)
Michael Lawrence
See Also
RestUri
, which is a lower-level but perhaps more
sensible interface.
Examples
apache <- RestContainer("http://wiki.apache.org")
apache$solr