Variables Cheat Sheet

List of all defined variables and their usage.

Note that JSONPath can only be used with request payload.

Variable Contains
input Request payload as XML or JSON
XQ: $input//*:id
JSONPath: $
request Alias for input
output Response payload. Only available after the response payload is generated
XQ: $output//*:status
Javascript: output.status.code
response Alias for output
accounts Array of accounts selected for this response
XQ: for $a in $accounts return $a/*:id
Javascript: accounts[0].id
account Single account selected for this response. If there are multiple matching accounts, a random account from that list
XQ: $account/*:id
http.method Request HTTP method (GET, POST, etc)
XQ: $http//*:method/text()
Javascript: http.method
http.relativeURI Relative URL from the service base
XQ: $http//*:relativeURI/text()
Javascript: http.relativeURI
http.queryString Query string (a part of request after ? symbol)
XQ: $http//*:queryString/text()
Javascript: http.queryString
http.parameters.parameter Query parameters. There are could be multiple entries for a parameter, hence XML may contain multiple parameter nodes and JSON then would contain an array of values
XQ: $http//*:parameter[@name='username']/text()
Javascript: http.parameters.accountid
http.headers.header HTTP request headers. There are could be multiple headers with the same name
XQ: $http//*:header[@name='X-UserName']/text()
Javascript: http.headers.accountid
rest.method Request HTTP method (GET, POST, etc). Same as http.method
XQ: $rest//*:method/text()
Javascript: rest.method
rest.relativeURI Relative URL from the service base. Same as http.relativeURI
XQ: $rest//*:uri/text()
Javascript: rest.uri
rest.parameters.parameter URI variables. E.g. userid in /foo/{userid}/add
XQ: $rest//*:parameter[@name='userid']/text()
Javascript: rest.parameters.userid
mockmeta.randomUUID Random UUID generated per request
XQ: $mockmeta//*:randomUUID/text()
Javascript: mockmeta.randomUUID
mockmeta.random Random value in a rang from 0 to 1 generated per request, e.g. 0.17943574832
XQ: $mockmeta//*:random/text()
Javascript: mockmeta.random
mockmeta.epochMs Number of milliseconds since epoch, i.e. since Jan 1st, 1970
XQ: $mockmeta//*:epochMs/text()
Javascript: mockmeta.epochMs
mockmeta.environment.* Current environment stats: number of calls and errors
XQ: $mockmeta/*:environment/*:calls/text() and $mockmeta/*:environment/*:errors/text()
Javascript: mockmeta.environment.calls and mockmeta.environment.errors
mockmeta.service.* Current service stats: number of calls and errors
XQ: $mockmeta/*:service/*:calls/text() and $mockmeta/*:service/*:errors/text()
Javascript: mockmeta.service.calls and mockmeta.service.errors
mockmeta.reaction.* Current reaction stats: number of calls and errors
XQ: $mockmeta/*:reaction/*:calls/text() and $mockmeta/*:reaction/*:errors/text()
Javascript: mockmeta.reaction.calls and mockmeta.reaction.errors

Examples of Variables


XML $http variable for /R22/Account/DeleteMe?id=500100 where environment URL is /R22 and service URL is /Account:

         <parameter name="id">500100</parameter>
         <header name="Connection">keep-alive</header>
         <header name="User-Agent">Apache-HttpClient/4.1.1 (java 1.5)</header>
         <header name="Host">localhost:7080</header>
         <header name="Accept-Encoding">gzip,deflate</header>
         <header name="Content-Length">11</header>
         <header name="Content-Type">application/xml</header>

Same variable http as JSON:

   "headers":    {
      "Connection": "keep-alive",
      "User-Agent": "Apache-HttpClient/4.1.1 (java 1.5)",
      "Host": "localhost:7080",
      "Accept-Encoding": "gzip,deflate",
      "Content-Length": "18",
      "Content-Type": "application/json"
   "method": "POST",
   "queryString": "id=500100",
   "parameters": {
   "relativeURI": "DeleteMe"


XML $rest variable for /SelfTest/REST/customers/12345/orders, where the environment URL is /SelfTest, service URL is /REST and the relative URL is expected to match customers/{customerId}/orders in the reaction:

         <parameter name="customerId">12345</parameter>

And the same variable rest as JSON:

   "method": "GET",
   "relativeURI": "customers/12345/orders",
   "parameters": {
	"customerId": "12345"


Variable $mockmeta in an XML reaction:


And variable mockmeta in a JSON reaction:

   "reaction":    {
      "errors": 0,
      "calls": 13
   "environment":    {
      "errors": 0,
      "calls": 28
   "randomUUID": "cbccd579-4399-4d2f-b2f7-7581aaa752da",
   "service":    {
      "errors": 0,
      "calls": 28
   "random": 0.5014546023803725,
   "epochMs": 1494198022337