Render back any part of the Request

The most basic thing you might want to do is render back in the response some part of the original request. This can be easily achieved using any of the following functions:

{{ Request.Scheme }} 
{{ Request.QueryParam.myParam }} 
{{ Request.QueryParam.NameOfParameter.[0] }} 
{{ Request.Path.[0] }} 
{{ Request.Method }} 
{{ Request.Host }} 
{{ Request.Body 'jsonpath' '$.id' }} 
{{ Request.Body 'xpath' '/root/id' }}
{{ Request.Body 'jsonpathfromxml' '$.id[0]' }} 
{{ Request.FormData.email }} 
{{ Request.Header.X-Header-Id }} 
{{ Request.Header.X-Header-Id.[0] }} 

Note that where the result is an array, you access it it using zero based indexes. Read more about these here.

Also note that the jsonpathfromxml function converts any XML body into a JSON body, but every element in the resultant structure will be an array, and so the jsonpath used to query it must take that into account.

Last updated