Skip to main content

Scenario

Let’s assume that Petstore API has been introduced to Apinizer when Apinizer worker is running on http://<SERVICE_IP>:30080/apigateway/ address.
  • API Proxy’s relative path value: "/apigateway/petstore"
  • API Proxy’s full address: http://<SERVICE_IP>:30080/apigateway/petstore/
  • Backend Routing URL: https://petstore.swagger.io/v2

Usage

When accessing the following endpoint with GET request:
http://<SERVICE_IP>:30080/apigateway/petstore/pet/findByStatus?status=pending
The requestUrlFromClient variable in the script policy contains the value "/pet/findByStatus". If it were a SOAP service, the value of this variable would be the SOAP method name. When the value "/xxx/yyy" is given to the requestBackendUrlToTargetAPI variable in the script policy, regardless of which method the request came to, the request goes to the following address with the current query param added:
https://petstore.swagger.io/v2/xxx/yyy?status=pending
This script should be run on the request line (Request Policy) because it uses the requestUrlFromClient and requestBackendUrlToTargetAPI variables.