In the concluding section of the tutorial, we will be focusing on the creation of an API, which serves as a consolidated entity enabling developers to incorporate both policies and steps. For this exercise, we will generate an API that directs to the same SAP S/4HANA REST endpoint URL employed in the prior exercise. Additionally, we will enhance its functionality by integrating traffic management features like Surge Protection and mediation capabilities such as the XML to JSON converter.
For all the subsequent steps in this exercise, please replace the xx in userxx with your respective id e.g user99
- Navigate to the sub-navigation item - "Integrations and APIs" under the Design tab on the left side pane and click on "Create" to create a package
- Create a package with the details as shown in the table below and click on Save. Replace xx with the id assigned to you.
Field | Value |
---|---|
Name | ASUG2023 userxx |
Technical Name | ASUG2023userxx |
Short Description | API to demonstrate the use case of API-Led Integration |
Version | v1 |
Vendor | SAP |
- Navigate to the Artifacts tab and add an API
- For the purpose of this exercise, we would be selecting the URL option
- Fill in the details for the API
Field | Value |
---|---|
Name | ASUG2023 API Artifact userxx |
URL | https://proxyavrdev.hana.ondemand.com/Proxy/jenkslave55.cpi.c.eu-de-1.cloud.sap/9912/sap/bc/srt/scs_ext/sap/salesorderbulkrequest_in |
API Base Path | /apiuserxx |
API State (select from dropdown) | Active |
API Version | 1.0.0 |
Runtime Profile (select from dropdown) | Edge Integration Cell - sap-teched-node |
- Post the successful creation of the API, navigate into the "Overview" tab to confirm if the details are correct
- Click on Edit and navigate to the "Policies" tab and this is how the starter content should look like. As you can see the Authentication policy appears by default.
- Double-click on the authentication policy and navigate to the property sheet at the bottom (note: use the scroll bar of your page to scroll and navigate down in case you are unable to see the property sheet). By default "Basic" is not enabled and for this exercise, you should enable the Basic checkbox from the multi-select drop-down and click on Save
- Click on the Authentication policy and you should see a pop-up with a set of actions. Click on the "+" icon. Select the surge protection policy from the drop-down and add the Surge protection policy.
- The policy protects the target endpoint from a sudden spike in incoming requests. Navigate to the highlighted section below in the property sheet of the policy and fill in the details as shown in the UI. We are effectively configuring the policy to allow only 5 calls in a span of 10 seconds
- Click on Request Reply and when the pop-up opens, click on the "+" icon. Select "XML to JSON Converter" from the drop-down. Configure the step in accordance with the highlighted section shown in the UI and click on Save
- Now we are ready to deploy the API on Edge. Click on "..." icon on the top right corner and from the dropdown select "Deploy". During creation, we had already configured the runtime profile and hence this would deploy the API to the configured edge runtime profile
- Post a successful deployment , the status field for the API should change from "Not deployed" to the corresponding state. In the UI, the highlighted section shows that the API is successfully deployed and is ready for execution
- Navigate out of the edit view by selecting "Cancel" from the dropdown as shown
- Now we would navigate to the monitoring shell navigation item on the left and select "Integrations and API". Post the selection, we would select the edge runtime profile from the dropdown.
- Under the Manage Integration Content section, click on the highlighted tile to navigate to the list view of all the deployed artifacts
- Select the artifact "ASUG2023 API Artifact userxx" and you should see the endpoint which would be used to access the API. Click on the highlighted icon and copy the deployed url to the clipboard. From the dropdown below, change the log level to "Debug" as shown below. Confirm the change on the dialog box which appears post the log level is changed from the dropdown.
- Now that we have successfully deployed the API, it is time to test the API. Create a new request in the insomnia client in a similar fashion as mentioned in the previous exercise. In the URL section, paste the URL that was already copied to the clipboard as part of the previous step. For the request, we would be using the credentials as shown below in the table
Field | Value |
---|---|
USERNAME | sb-93d61073-f8ba-4faa-98e0-89fd3a424277!b2246|it-rt-iat-prism-std!b144 |
PASSWORD | 174ebb0d-4e0f-43dd-994a-58629ec524bf$mPrfigEVYsOs71X2jfWBkBB7e24Mi8M94xkCuREs1Yo= |
- Post a successful request, we would try to simulate the scenario, where we violate the criteria for surge protection policy. Execute the request on the insomnia client by clicking on the "Send" button repeatedly such that we end up executing more than 5 requests in a span of 10 seconds. Ideally, on making the 6th request, the surge protection policy should get triggered and you should see a response as shown in the UI.
- Now , we would navigate back to the monitoring UI to visualize the execution flow. Click on Monitor Message Processing link as shown in the UI for the artifact artifact "Teched2023 API Artifact userxx" and this should show all the executions of the API with the latest execution appearing right at the top
- Select the latest execution entry and click on the Debug link as shown below
- We can see that the failure happened at the Surge protection policy and on clicking the "x" icon, we can see the actual error in the toast message
You've now completed the following:
- Able to model an API
- Deployed it on the Edge Integration Cell
- Execute the API and violate the surge protection policy successfully which prevents the backend from traffic surges
- Monitor the execution flow of the API