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.
The RestContainer
object maps familiar R list accessors to CRUD
operations on '>RestUri
.
x[] <- value
: Creates resources for the objects in
value
at x
. This is the
create
/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 the
read
/GET
operation.
x[i]
: Reads the named elements, which are returned in a
list. This is the vectorized read
/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 with value
. This is the
update
/PUT
operation.
x[i] <- value
: Updates resources at x
with the
objects in value
, a list. This is the
vectorized update
/PUT
operation.
x$name <- NULL
, x[[i]] <- NULL
: Deletes the named
resource. This is the delete
/DELETE
operation.
RestContainer(...)
: Constructs an instance based on
RestUri(...)
.
'>RestUri
, which is a lower-level but perhaps more
sensible interface.
# NOT RUN {
apache <- RestContainer("http://wiki.apache.org")
apache$solr
# }
Run the code above in your browser using DataLab