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

{{$variable.var-name}}

For instance, if you define a variable named myvar in a Declare Variable block, you can access it using {{$variable.myvar}}.

Accessing Block Data

  1. Action Block: To access data from any other action block, regardless of its position in the workflow, use the following syntax:
{{$action-name.val}}

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.

  1. 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.
{{$request.header.header-name}}
  • Body: The main content of the response from the website/service.
{{$request.body.key-name}}
  • Params: Specific details included in the URL path (like page numbers or IDs).
{{$request.params.param-name}}
  • QueryParams: Additional details added to the URL after a question mark (?).
{{$request.queryParams.queryparam-name}}
  1. HTTP Request Action Block: The HTTP Request returns response and status. You can access the outputs of this block by
{{$action-name.status}}
{{$action-name.val}}

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:

{{$secrets.secret-name}}

Replace secret-name with the actual name you gave to the secret when you stored it.