rest api

Consumer API for rest api.

import {
  getJSON,
  postJSON,
  putJSON,
  delJSON,
  postData,
  putData,
} from '@dormakaba/digital-reactnative-client';

const res = getJSON(route, options);
const res = postJSON(route, data, options);
const res = putJSON(route, data, options);
const res = delJSON(route, options);

const res = postData(route, data, options);
const res = putData(route, data, options);

If a route does not start with http(s):// it will take the host defined in settings util settings.get('restApi.url').

For requests needing authorization you can set options { authorized: true } it will set Authorization: Bearer ${token} with the token taken from settings util settings.get('restApi.token').

Request options

Name

Type

Description

authorized

boolean

Set Bearer token like described in above hint

headers

object

Additional headers to send

Last updated