After reading this article you will know:

  • What request variables are
  • How to setup a request variable
  • How to use request variables

What are request variables

We've added request variables to the web module in order to let you use the available variables of the request of a page. This simply means request variables are the variables which the page gets, when requested.

The most common request is the GET request, which literally means opening a web page. When you open a web page, you perform a request which has certain variables, such as your IP address. You can save these variables in a custom model if you setup a request variable.

Whenever you setup a request variable a custom model is assigned or generated for the page. The custom model can be viewed and altered at the custom models overview of your app (Tools > Custom Models). The default generated properties are:

  • Headers
  • Version
  • Accept
  • Connection
  • Referer
  • Host
  • User_agent
  • accept_language
  • accept_encoding
  • uri
  • client_ip
  • body
  • Query
  • Params
  • Method

The standard request variables custom model's JSON is as follows:

How to create request variables

For reference, see video above.

  • Step 01 Create a new endpoint (or open an existing one).
  • Step 02 Define the request variables at the bottom of the page settings.
  • Step 03 Use your request variables object as you please.

Example use

Let's say you have named your request variable "request". Then


yields the IP address, or


yields the browser the user used to visit your page. You can even use var:request.body in combination with the "xpath()" function to parse an XML request.

Above examples can also be done using liquid:


You can get the body as JSON by using:

#{{request.body | json }}
Did this answer your question?