Policies are applied to an API Proxy to customize its behavior. These are preprocessing steps which are run on the SAP API Management layer and not on backend services.
Policies can be broadly classified into following four categories:
The traffic management policies let us configure cache, control traffic quotas and spikes, set concurrent rate limits. Example of these types of policies are:
These policies let us perform message transformation, parsing, validation and raise faults and alerts. Examples include the following policies:
These policies controls the security related aspects for API Proxies. Examples include:
These policies let us provide custom policy functionality, with support for features as service callout, message data collection, and calling Java, JavaScript and created Python behavior. Examples include:
When a policy is added to an API Proxy, then it is added to a specific flow which defines when the policy is executed. Each request and response path in a proxy endpoint and target endpoint defines the following flows:
Let’s add a policy to an API Proxy.
Click on Launch Policy Designer
Click on PreFlow (in left panel) and then click on Verify API Key among the list of policies (on right side panel).
Just add the policy name and click Add.
Then, the policy will get added & then add the following text in the script area:
<VerifyAPIKey async='true' continueOnError='false' enabled='true' xmlns='http://www.sap.com/apimgmt'> <APIKey ref='request.header.apikey'/> </VerifyAPIKey> |
Then update the policy by clicking Update.
Then the API Proxy will be updated with newly added policy; and then Click Save.
The API Proxy will be updated successfully.
Create a product, adding this newly created API (“CATALOGSERVICE”). Refer here for more details.
Publish this product
To consume the API via product, we need to now login to the developer portal. Once logged in, we will find the newly published API Product here.
Then, an application has to be created using this Product. Refer here for more details.
Open the details of this product and subscribe it to a new application; as shown below:
Enter application details like name, description and click save to create the application. Once created successfully, you will get an appkey and secret for that application.
This is how you can create an API proxy with Verify API Key Policy and consume the same.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
35 | |
25 | |
17 | |
13 | |
8 | |
7 | |
6 | |
6 | |
6 | |
6 |