Skip to content

Inline variables in fields

Any text field on a request accepts a Handlebars expression written inline. This is the most direct way to parameterise a call: no setup beforehand, and substitution happens at send time.

  • the URL (including scheme, host, port and query string);
  • headers, in both key and value;
  • query parameters and path parameters;
  • the body: raw JSON, XML, form, x-www-form-urlencoded;
  • the fields specific to each protocol: MQTT topic, AMQP routing key, gRPC message, GraphQL query and its variables, Redis command, Kafka key…

A fully parameterised URL:

{{scheme}}://{{host}}:{{port}}/v{{apiVersion}}/clients/{{clientId}}

A composite header:

Authorization: Bearer {{accessToken}}
X-Request-Id: {{uuid}}

A JSON body mixing variables and helpers:

{
"reference": "CMD-{{timestamp}}",
"client": "{{clientId}}",
"libelle": "{{uppercase produit}}",
"montant": {{multiply prixUnitaire quantite}},
"creeLe": "{{now}}"
}

An MQTT topic and an AMQP routing key:

capteurs/{{site}}/{{capteurId}}/mesures
commandes.{{pays}}.creees

Underneath the relevant fields, Restorm shows the resolved value for the active environment. That is the reflex to acquire before wondering why a call went out to the wrong URL: the answer is almost always visible right there.

A URL field containing {{baseUrl}}/pet/{{petId}}, with its value resolved by the active environment shown just below

Ctrl+Space triggers autocompletion in the fields that support it: it offers the current environment’s variables and the Handlebars helpers, with their signature and an example.

  • An unresolved expression (a variable that does not exist) renders an empty string — it does not raise an error. Hence the importance of the preview.
  • The template is compiled without HTML escaping: an & or a < inside a value passes through intact, which is the expected behaviour for JSON or XML.
  • Argument-less helpers ({{uuid}}, {{now}}, {{$randomEmail}}…) produce a different value on every send. That is deliberate, and handy for correlation identifiers.

Full reference: Handlebars helpers.