Overview of Metrici REST support

Metrici provides a comprehensive REST support. The REST support uses the same node URLs as other node access, and Metrici automatically switches between REST calls and HTML depending on headers. The full rules are defined in Distinguishing REST calls from normal browser access.

The REST interfaces uses the five standard HTML methods GET, DELETE, PUT, PATCH and POST:

  • GET returns a JSON representation of the node. By convention, the query parameter view can be used to specify different views of the node data (for example, different subsets of node data or data from related nodes).
  • DELETE deletes the node.
  • PUT creates or updates a node. Node data is passed in the body of the request as JSON. Some nodes act as folders, and a PUT on these nodes will create a new node within the folder. Other nodes do not act as folders, and a PUT will update the node. When used to update a node, a PUT will update all the data of the node.
  • PATCH updates a node, but not necessarily all of the data.
  • POST performs an action on the node, which could be a create, delete or update, or to run an action, or return some data. Parameters to the POST are passed in the request body.

The interpretation of these methods depends on the node itself, i.e. a node must support these REST methods for the call to have any effect. See Mapping REST calls to Metrici services for details.

REST calls are authenticated in one of three ways.

  • If made within a web session (from a browser), the REST call is authenticated as the session users.
  • By HTTP basic authentication.
  • Using a JWT bearer token. See Authenticating calls using JWT for details.