
Certain variables are built into the API Gateway. One such variable is ${request.url.query}. To demonstrate how this variable is commonly used, I setup http://www.freekb.net/Stage1 to return the value stored in the "foo" key, like this.
- In the Policy Manager, select Publish Web API to create a REST service
- Give your service a unique name, such as myService.
- Target URL = The URL that requests will route out to (outbound), which would be http://www.freekb.net/Stage1${request.url.query} in this example
- Gateway URL = The context root of the URL that requests will route into (inbound), such as /example
- Select Finish.
You can now get http://www.freekb.net/Stage1${request.url.query} through the API Gateway. Let's say your API Gateway is configured with https://api.example.com. Since you defined /example as the endpoint for myService, you would use https://api.example.com/example to route requests through the API Gateway and onto http://www.freekb.net/Stage1${request.url.query}. To put this another way, in this example, https://api.example.com/example is the inbound URL and http://www.freekb.net/Stage1${request.url.query} is the outbound URL.
- Inbound URL = https://api.example.com/example?foo=bar
- Outbound URL = http://www.freekb.net/Stage1/?foo=bar
You should get the following.
Did you find this article helpful?
If so, consider buying me a coffee over at