Variable Block
Variable blocks store a value which can be used later on in building the endpoint. You can store Text, Number, a List and a Dictionary.
# How to create a variable block
- Drag “Variable” under “Control Blocks” from block picker and drop it under the desired block in workspace.
- Next, enter name and value of the variable. Later if you want to use this value, you will simply use this variable name.
- Select "Save" to add variable block.
# How to use variable
To use the value in the variable in different blocks, put variable name in double curly braces. For example to use value stored in variable named “name” you have to use as follows:
{{name}}
To use the value of key of dictionary simply use dot operator:
{{dictionary.key}}
To access element of a list simply use list index in a pair of square brackets:
{{list[0]}}
# Reserved variables
There are 2 reserved variables with “data” variable and “user” variable.
- data variable stores the JSON data sent in the API request or via get parameters. To access particular key in JSON data use following:
-
User variable stores user data who is sending request. This is
only possible if the user has been authenticated prior and
request has the JWT token which was generated during sign in.
User variable has following keys: name, username, email and id. You can access those as following:user.key
data.key