RestContainer-class: RestContainer

RestContainer-classR 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 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.

Constructor

  • RestContainer(...): Constructs an instance based on RestUri(...).

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

lawremi/restfulr documentation built on June 19, 2022, 11:08 p.m.