Makes a request to the passed target and fetches the body. Useful for API connections. HTTP Headers and params can be set for the request. Inside the block the response is accessible as responsevariable.


Accepts the following arguments:

The target for the HTTP request. E.g.

Multiple key/value attributes that serve as url query parameters for GET requests.

If the request method is POST, PUT, PATCH or DELETE, these params will be set in the body. If a string is provided, this will be directly set to the body. If a Liquid object is provided, this will be mapped to JSON or www form, depending on the argument request_body_type


Used for POST, PUT, PATCH or DELETE request to determine the request body should be formatted, in case a Liquid object is given for params. Possible values: ”json”, ”www_form”. Defaults to ”json”

Multiple key/value attributes that serve as request headers. The keys must be downcased and with underscores, but get converted to camelcased with dashes. E.g. {x_my_header_key: "header_val"}becomes the header: X-My-Header-Key: header_val.

Sets the request method: GET, POST, PUT or DELETE. Defaults to GET.

Available variables

The following variables are available inside the block:

The response of the request. If the response was JSON, the data converts to a Liquid object. You can use the to_json filter to turn it back to json.

The passed params as a Liquid object.

The request method. GET, POST, PUT or DELETE

The full target url, so including passed params. E.g.



1 2 3 4 5 6 7 8 9 10 11 12 {% http_request target: '', method: 'get', params: { param_key_1: 'param_val_1' }, headers: { authentication: 'Token token=ksuhf3ygjyw3fskuddh3uhr4hwr556h6j6eda' } %} {{ response }} {{ response | to_json }} {% for response_item in response %} {{ response_item.result_key }} {% endfor %} {{ params }} {% endhttp_request %}


1 2 3 4 5 6 7 [{"result_key" => "result value 1"}, {"result_key" => "result value 2"}] [{"result_key": "result value 1"}, {"result_key": "result value 2"}] result value 1 result value 2 {'param_key_1' => 'param_val_1'}

Note that the arguments params and headers have nested key/value pair arguments. These need to be surrounded by curly braces ({ ... }).

Advanced mode

If you want to retrieve more information about the response, you can provide an extra argument advanced: true. This will cause the response variable to be a liquid object where:

response.body is the body of the response.

response.code is the status code of the response (e.g. 200, 404 etc).


Assuming the server returns “The response body from the server” as response body:


1 2 3 4 {% http_request target: '', method: 'get', advanced: true %} {{ response.body }} {{ response.code }} {% endhttp_request %}


1 2 "The response body from the server" 200