Contents
Introduction
A Settings service allows you to save app information such as API keys, URLs into a settings file and then reference the data from anywhere in the app. This will also allow you to make any changes only in one place instead of replacing the same value everywhere in the app.
Creating new Settings service
To create a new Setting service, from Project view > Create New > Service, check Setting and click Create Service button. An empty Settings service looks like this:
To create a parameter, enter its name and click the Add button:
It’s basically a properties file with key/value entries. You can also specify an optional description.
Using values from Settings service
You can use the values from Setting service in defining a REST service and also in JavaScript.
Using in REST service
- When defining a REST service, set the Settings property to the settings service name:
- To refer to a value in the settings file, use {name}. For example: {url}.
Using in Request tab:
Using in JavaScript
It’s also possible to access the values in this service from any JavaScript. For example:
var apiKey = AppSettings['apiKey'];
or
var apiKey = AppSettings.apiKey;
Plug-ins
Most plug-ins will use a Setting service to keep data such as API keys in one centralized place. When creating a new plug-in, you can keep such data in Settings service as well.