Fake.REST logo
Fake.REST
Topics
Getting started
Dynamic templating
Scripting

Request data

Following request data accessors available:

The body variable: to use data from request body (supported content types: application/json and application/x-www-form-urlencoded )

For example.

{
  "success": true,
  "page": "{{body.id}}",
}

The qry variable: to use data from query string e.g.:

http://some-server.com?qryParam=value

For example.

To get the someId parameter of GET Request:

https://api.fake.rest/.../task/list?someId=3

You can use qry.someId syntax in the template

{
  "success": true,
  "page": "{{qry.someId}}",
  "data": [...]
}

The params variable: to use params valuse from url path e.g.

http://some-server.com/path/{param1}/{param2}

Parameters could be part of the method name. To add parameter use {paramName} syntax.

For example, to get params from following path:

https://api.fake.rest/.../{page}

Could be used following template:

{
  "success": true,
  "page": "{{params.page}}",
}