- For example, let's introduce the Petstore API to Apinizer when the Apinizer worker is running on http://<SERVICE_IP>:30080/apigateway/.
- Let the relative path value of this API Proxy be "/apigateway/petstore".
- In this case the full address of this API Proxy would be as follows:
http://<SERVICE_IP>:30080/apigateway/petstore/
- For the request sent to the above address, the backend Routing URL should be:
https://petstore.swagger.io/v2
- Let's add a script to this API Proxy.
- Let's access the following endpoint with a GET request:
http://<SERVICE_IP>:30080/apigateway/petstore/pet/findByStatus?status=pending
- In this case, the request came to the endpoint: /pet/findByStatus
- The "requestUrlFromClient" variable in the script policy contains the value "/pet/findByStatus". If this Service was Soap, the value of this variable would be the name of the Soap method.
- When the "requestBackendUrlToTargetAPI" variable in the script policy is changed to the value "/xxx/yyy", the current query param is added to the request, regardless of which method the request comes from, and it will go to the following address:
https://petstore.swagger.io/v2/xxx/yyy?status=pending