Product changes

New feature - Request variables

Written by Daniel Willemse | Jul 25, 2017 11:36:00 AM

For those of you who had troubles creating endpoints for an API that required specific data from the request, your aches and pains are a thing of the past. This release comes with a little pill called "the request variable" and it packs quite a punch!

 

The new endpoint request variable feature to read specific request values

 

Let's say you are building an incoming API endpoint and you need to know which IP address the request was sent from. Or if a certain application sends requests to your endpoint with specific headers and you need to read the "authorization" header for instance. Previously, there was no way of reading these values for endpoints. With the request variable however, you can. Each endpoint now has the option to add a name for the request variable. Simply give it a name and we will generate a custom model for you. This custom model can then be used in expressions or in your template with all the data you need.

Let's say you have named your request variable "request". Then "var:request.client_ip" yields the IP address, or "var:request.headers.user_agent"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. This should be a nice addition to the tool bag for creating endpoints.