This article is for LoopBack 2.x, which is no longer supported. Please see the corresponding article for 3.x.

Role REST API

Edit this page
The built-in Role model represents a set of access controls that can apply to a specific user.
Page Contents

Note: You can use the StrongLoop API Explorer to quickly construct and make requests to a LoopBack app running on the server. If a LoopBack app is running on localhost at port 3000, then by default API Explorer is available at http://localhost:3000/explorer/.

All of the endpoints in the Role REST API are inherited from the generic PersistedModel REST API. The reference is provided here for convenience.

Quick reference

URI Pattern

HTTP Verb Default Permission Description Arguments

/roles

POST Allow

Add role instance and persist to data source.

JSON object (in request body)
/roles GET Deny Find instances of roles that match specified filter.

One or more filters in query parameters:

  • where
  • include
  • order
  • limit
  • skip / offset
  • fields
/roles PUT Deny Update / insert role instance and persist to data source. JSON object (in request body)
/roles/id GET Deny Find role by ID: Return data for the specified role instance ID. id, the role instance ID (in URI path)
/roles/id PUT Deny Update attributes for specified role ID and persist.

Query parameters:

  • data - An object containing property name/value pairs
  • id - The model id
/roles/id DELETE Deny Delete role with specified instance ID. id, role ID(in URI path)
/roles/id/exists GET Deny

Check instance existence: Return true if specified role ID exists.

URI path:

  • id - Model instance ID
/roles/count GET Deny

Return the number of role instances that matches specified where clause.

Where filter specified in query parameter
/roles/findOne GET Deny

Find first role instance that matches specified filter.

Same as Find matching instances.

AltStyle によって変換されたページ (->オリジナル) /