v2

v2

Representation of a CREST v2 resource.

Constructor

new v2(resourceURL, optionsopt)

Source:
Creates a new instance.
Example
import { CRESTv2 } from "@forgerock/crest-js";

const resource = new CRESTv2("http://www.example.com");
Parameters:
Name Type Attributes Default Description
resourceURL string URL of the resource.
options object <optional>
{} Options.
Properties
Name Type Attributes Default Description
middleware Array.<middleware> <optional>
[] Middleware.
resourceVersion string <optional>
1.0 Resource version.

Members

(readonly) protocolVersion

Source:
CREST protocol version.

Methods

action(action, optionsopt) → {Promise.<Response>}

Source:
See:
Invokes an action on a resource provider.
Parameters:
Name Type Attributes Default Description
action string Action name.
options object <optional>
{} Options.
Properties
Name Type Attributes Description
body object <optional>
Action body.
queryString object <optional>
Additional query string.
Returns:
A Promise that resolves to a Response object.
Type
Promise.<Response>

create(body, optionsopt) → {Promise.<Response>}

Source:
See:
Creates a resource.
Parameters:
Name Type Attributes Default Description
body object Resource representation.
options object <optional>
{} Options.
Properties
Name Type Attributes Description
id string <optional>
Client provided ID for the resource.
queryString object <optional>
Additional query string.
Returns:
A Promise that resolves to a Response object.
Type
Promise.<Response>

delete(id, optionsopt) → {Promise.<Response>}

Source:
See:
Deletes a single resource by ID.
Parameters:
Name Type Attributes Default Description
id string Resource ID.
options object <optional>
{} Options.
Properties
Name Type Attributes Description
revision string <optional>
Revision ID.
queryString object <optional>
Additional query string.
Returns:
A Promise that resolves to a Response object.
Type
Promise.<Response>

get(id, optionsopt) → {Promise.<Response>}

Source:
See:
Retrieves a single resource by ID.
Parameters:
Name Type Attributes Default Description
id string Resource ID.
options object <optional>
{} Options.
Properties
Name Type Attributes Description
queryString object <optional>
Additional query string.
Returns:
A Promise that resolves to a Response object.
Type
Promise.<Response>

queryFilter(optionsopt) → {Promise.<Response>}

Source:
See:
Queries a resource collection.
Parameters:
Name Type Attributes Default Description
options object <optional>
{} Options.
Properties
Name Type Attributes Description
queryString object <optional>
Additional query string.
Returns:
A Promise that resolves to a Response object.
Type
Promise.<Response>

update(id, body, optionsopt) → {Promise.<Response>}

Source:
See:
Updates a single resource by ID.
Parameters:
Name Type Attributes Default Description
id string Resource ID.
body object Resource representation.
options object <optional>
{} Options.
Properties
Name Type Attributes Description
revision string <optional>
Revision ID.
queryString object <optional>
Additional query string.
Returns:
A Promise that resolves to a Response object.
Type
Promise.<Response>