Variables

There are two types of variables available that you can use inside a Draftbit app.

Variable Type

Description

App Variables

Variables that can be set and utilized across your entire application. For example, an API Key or a Client ID for one of your REST Service.

Each time your app restarts, this type of variable will reset to its default value.

Device Variables

Variables that allow you to store data on your app users' devices. For example, when implementing auth with your REST API service, the auth token obtained back from the service is usually stored in this type of variable.

Each time your app restarts, this type of variable will not reset to the default value and will use the last value stored in it.

Adding a variable

  • To add variables, open the Variables modal from the top menu.

This will open the modal below:

JSON Primitive Values

In an App Variable and a Device Variable, all JSON primitive types of values can be stored.

In JSON, values must be one of the following data types:

  • string
  • number
  • boolean
  • JSON object
  • array

Did this page help you?