> For the complete documentation index, see [llms.txt](https://dormakaba-digital.gitbook.io/reactnative-client/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://dormakaba-digital.gitbook.io/reactnative-client/concerns/rest-api.md).

# rest api

Consumer API for rest api.

```javascript
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);
```

{% hint style="info" %}
If a route does not start with `http(s)://` it will take the host defined in settings util `settings.get('restApi.url')`.
{% endhint %}

{% hint style="info" %}
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')`.&#x20;
{% endhint %}

### Request options

| Name       | Type    | Description                                   |
| ---------- | ------- | --------------------------------------------- |
| authorized | boolean | Set Bearer token like described in above hint |
| headers    | object  | Additional headers to send                    |
