Environment Variables
In Zeromagic, you can effortlessly access variables and values from one block in other blocks. Each action block in Zeromagic has a predefined data structure, specifying the format and structure of the data it generates. This data structure is detailed in the documentation for each action block.
Zeromagic offers multiple options to access the outputs generated by other action blocks.
Accessing Variable Data
All variables defined in the workflow can be easily accessed in other blocks. To access a defined variable, use
For instance, if you define a variable named myvar in a Declare Variable block, you can access it using {{$variable.myvar}}
.
Accessing Block Data
- Action Block: To access data from any other action block, regardless of its position in the workflow, use the following syntax:
where action-name
is the name of the action block you want to retrieve the outputs from, and val
is the output value of that block.
For example, to access the outputs of an action block named createOne, you would use {{$createOne.val}}
.
Spaces are not allowed in the action block name.
- API Endpoint Action Block: The
API Endpoint
returns headers, body, params and queryparams. You can access the outputs of this block by
- Headers: Information sent along with the request, like authentication details.
- Body: The main content of the response from the website/service.
- Params: Specific details included in the URL path (like page numbers or IDs).
- QueryParams: Additional details added to the URL after a question mark (?).
- HTTP Request Action Block: The
HTTP Request
returns response and status. You can access the outputs of this block by
Accessing Secrets Data
All the secrets defined in the Secrets
section of the Project console can be accessed in the workflow. If you need to use a secret in your workflow, you can access it using the following syntax:
Replace secret-name with the actual name you gave to the secret when you stored it.
Was this page helpful?