Building a Loopback API (no target endpoint) using SAP Cloud Platform API Management
A Loopback API proxy is an API Proxy without any target endpoint configured. Some of the scenarios for building a Loopback API Proxy in SAP Cloud Platform API Management :-
- As an OAuth token issuer API Proxy to issue OAuth access token based on Application key and Secret
- As a ping API call that can be integrated into your monitoring sites to check on the status of your API Proxies.
In this blog, we have showcased the steps to create a Loopback API Proxy using SAP Cloud Platform API Management
Create a Loopback API Proxy
- Logon to your SAP Cloud Platform, API Management account (say https://account.hanatrial.ondemand.com/cockpit).
- Navigate to the Services tab, search for API Management service tile and click to open SAP API Management service.
- Click on the link Access API Portal to open API Portal.
- Navigate to the Develop from the hamburger icon, then select the tab APIs and Click on the Create button
- Create a new API Proxy for any endpoint. Select the URL radio button and provide the API Proxy details like Proxy name, title, description and base path and click on the Create button.
|Title||A sample loop back APIs|
|API Base path||/loopback|
Note:- The target URL provided in this Create API Proxy would be just a placeholder and any valid URL can be provided.
- Navigate to the Proxy EndPoint tab and under the Route Rules the route condition between the API Proxy endpoint and Target endpoint can be specified. Route rules in SAP Cloud Platform API Management allows the user to define how the traffic from your API Proxy endpoint should be routed to the target endpoint. Any time the API Proxy is created from the Create API wizard, the default route rules of routing the API Proxy call to the provided target endpoint is set automatically. Since in this scenario , we would be creating a loopback API Proxy , i.e, no calls to be routed to the target endpoint, we can change this default mapping so that the Target End point is set to None.
- Click on the Deploy button to deploy the Loopback API Proxy. This would generate the API Proxy URL for the newly deployed API Proxy.
With this a Loopback API Proxy has been created successfully.
Finally testing the flow
SAP Cloud Platform API Management, comes with an integrated test console which can be used for testing your API Proxies. In this section, steps to test Loopback API Proxy flows has been captured.
- Navigate to the Test tab.
- In the Filter tab, enter your API Proxy name to quickly filter and select your API Proxies to be tested.
- You can select the HTTP methods for your API , say GET or POST and then click on the Send button. Since this is a loopback API Proxy the request passed by you would be returned in the response and no call would be routed to your target endpoint.
For more blogs on SAP Cloud Platform API Management visit us at SAP Community