User-Defined Variables

The Variables section is a key-value storage for storing and reusing some data. It is often used for removing code duplicates and improving readability: the greetingUrl variable says more than just the line https://next.json-generator.com/api/json/get/EJvQVEVGL for sure.

The variables mechanism is very well integrated to all application parts and has several features:

  • You can use strings, objects, arrays, and links to other variables as values.

  • Variables are defined for each node and are inherited from parent nodes.

  • Variables values can refer to other variables.

  • Default variables names start with $.

Using Variables

You can use variables in any string parameters of the node - URLs, headers names, authorization tokens, etc. To do that, use the ${variableName} syntax, where variableName is a link to the variable. Here are some examples:

  • ${id}

  • ${$dynamicVar.id}

  • ${$response.body.name}

It's possible to combine strings and links to other variables in the node parameters fields. For instance, you can use http://${host}/posts/${$dynamicVar.id} as an URL.

To access an array element, that is stored in a variable, you can use the ${variableName[index]} syntax. For example, to access the third response entity id, you'll write ${$response.body[2].id}. Note that it the index is zero-based.

Autocompletion works for variables:

Variables autocompletion

Variable value highlighting works as well:

Variable value highlighting

There is the Variables button in every node interface, that opens the variables dialog. This is how the button looks like:

The button to open the variables dialog

The button looks the same for all node types. You'll learn more about how to work with variables in the next sections.