SAP API Management, SAP Gateway, SAP Hybris Cloud for Customer, SAP S/4HANA Cloud

SAP Cloud Platform API Management : Metadata cache for OData APIs

Metadata Cache for OData APIs policy template in SAP API Business Hub allows a full caching of the metadata which significantly increases the performance of OData APIs managed by SAP Cloud Platform API Management. A policy template is a collection of policies or behaviors that can be reused across API Proxies, this policy template improves the performance of OData APIs by caching the $metadata response and reducing the load on the target system by returning the cached metadata response from SAP Cloud Platform API Management.

In this blog, the usage of Metadata Cache for OData APIs policy template for OData APIs from various target system like SAP S/4HANA Cloud, SAP SuccessFactors, SAP Gateway, SAP Hybris Cloud for Customer or Third party is covered in detailed.

Pre Requisites

  1. SAP Cloud Platform API Management

Discover and Copy Metadata Cache for OData APIs policy template

From SAP Cloud Platform API Management, all the APIs and policy templates available in SAP API Business Hub can be discovered via the Discover tab.

  • Logon to your SAP Cloud Platform, API Management account
  • Navigate to the Services tab, search for API Management service tile and click to open SAP API Management service.

SAP API Management, SAP Gateway, SAP Hybris Cloud for Customer, SAP S/4HANA Cloud

  • Click on the link Access API Portal to open API Portal.

SAP API Management, SAP Gateway, SAP Hybris Cloud for Customer, SAP S/4HANA Cloud

  • Navigate to the Discover from the hamburger icon

SAP API Management, SAP Gateway, SAP Hybris Cloud for Customer, SAP S/4HANA Cloud

  • SAP API Business Hub is integrated into SAP Cloud Platform API Management and therefore all the APIs and Policy templates available in SAP API Business Hub can be easily discovered and consumed in SAP Cloud Platform API Management.
  • Navigate to the All tab, search and select Metadata Cache for OData APIs.

SAP API Management, SAP Gateway, SAP Hybris Cloud for Customer, SAP S/4HANA Cloud

  • Navigate to the Artifacts tab and select cacheMetadata policy template.

SAP API Management, SAP Gateway, SAP Hybris Cloud for Customer, SAP S/4HANA Cloud

  • Click on Copy to copy the metadata cache policy template into SAP Cloud Platform API Management tenant

SAP API Management, SAP Gateway, SAP Hybris Cloud for Customer, SAP S/4HANA Cloud

  • Copied metadata cache policy templates would be available under POLICY TEMPLATES tab of Develop view.

SAP API Management, SAP Gateway, SAP Hybris Cloud for Customer, SAP S/4HANA Cloud

Apply Metadata Cache for OData APIs policy template to SAP S/4HANA Cloud OData APIs

Discover, Consume and Manage SAP S/4HANA Cloud APIs the detailed steps to access the Read Planned Orders SAP S/4HANA OData API and the management of the Read Planned orders API via SAP Cloud Platform API Management is covered. In this section steps to apply metadata cache to the API_PLANNED_ORDERS API Proxy is covered in details.

  • Click on APIs tab and select API_PLANNED_ORDERS SAP S/4HANA Cloud OData API.

SAP API Management, SAP Gateway, SAP Hybris Cloud for Customer, SAP S/4HANA Cloud

 

 

 

 

  • Click on Policies to navigate to the Policy designer view.

SAP API Management, SAP Gateway, SAP Hybris Cloud for Customer, SAP S/4HANA Cloud

  • Click on Edit to switch to the editable mode.

SAP API Management, SAP Gateway, SAP Hybris Cloud for Customer, SAP S/4HANA Cloud

  • Select Apply from the Policy Template.

SAP API Management, SAP Gateway, SAP Hybris Cloud for Customer, SAP S/4HANA Cloud

  • Select the newly copied cacheMetadata template from Apply Template dialog.

SAP API Management, SAP Gateway, SAP Hybris Cloud for Customer, SAP S/4HANA Cloud

  • Click on Update to save changes in the policy designer.

SAP API Management, SAP Gateway, SAP Hybris Cloud for Customer, SAP S/4HANA Cloud

  • Click on Save to apply the changes to the API_PLANNED_ORDERS.

SAP API Management, SAP Gateway, SAP Hybris Cloud for Customer, SAP S/4HANA Cloud

With this caching of the OData metadata has been completed.

Finally testing the flow

  • Select the RESOURCES tab and click on GET operation view all planned orders from your SAP S/4HANA Cloud tenant.

SAP API Management, SAP Gateway, SAP Hybris Cloud for Customer, SAP S/4HANA Cloud

  • This would open up the Test Console, click on the Authentication option and select Basic Authentication

SAP API Management, SAP Gateway, SAP Hybris Cloud for Customer, SAP S/4HANA Cloud

  • In the URL, provide the $metadata URL by appending $metadata after API_PLANNED_ORDERS.
  • Click on Send to test the API Proxy for Read Planned Orders

SAP API Management, SAP Gateway, SAP Hybris Cloud for Customer, SAP S/4HANA Cloud

  • The first response time would be little higher.

SAP API Management, SAP Gateway, SAP Hybris Cloud for Customer, SAP S/4HANA Cloud

  • The subsequent time would be much faster.

SAP API Management, SAP Gateway, SAP Hybris Cloud for Customer, SAP S/4HANA Cloud

The Metadata cache policy template can be applied to any OData API to improve the performance of Odata APIs by caching $metadata response and reducing road trips to the target system for metadata calls.

Leave a Reply

Your email address will not be published.