Today we are excited to announce the launch of an exciting addition to the support space for SAP HCP, API Management, a Public GitHub repository of sample API Proxies and Applications to showcase some of the capabilities SAP HCP, API Management offers, in a quick and easy to consume manner.

For those familiar with GitHub, you may simply want the URL to run with, but for those less familiar, I will be providing a simple walk through on the simple method of grabbing a sample API Proxy and importing into your own environment. This walk-through will follow the Trial account, but the process will be the same for Productive customers as well.

Getting Access

The GitHub can be found here: SAP Public GitHub – SAP HCP, API Management API Proxies

Getting Started

PreReqs

Once you are on the GitHub Page you can either navigate directly through the code (if you are familiar with GitHub):

GitHub_Code_Large.png

Or for those wanting a little explanation of what samples are available first, scroll down the homepage for a documented samples list.
For this walk through we will select the Spike Arrest policy sample. As the documentation tells us, this is a type of Throttling policy, which will restrict how quickly requests can be made against an API Proxy.

Simply click the name to open the related folder.

Sample_List_Select.png

As before you will be presented with multiple ways to consume the API Proxy, either from the direct listing, or from the documentation area. Additionally you will see documentation explaining the what the Policy is intended to do, the code it contains, and how the code works, as well as a link to more in-depth documentation specific to the policy type.

Once finished reading, click on either Zip file to access the Sample download.

SpikeArrest.png

This will bring you to the download page. Click either “View Raw” or “Download” button to save the sample. Make sure to keep track of where the file downloads, as you will need this to import later.

Download_Spike_Arrest.png

Importing the Sample into API Management

Once the download completes, access your HCP Trial API Management account. ( HCP Trial Account  -> Services tab under -> Integration category -> SAP API Management)

Access_API_Portal.png

This will bring you to the Home screen of SAP API Management Administrator Portal. Click the three horizontal bars in the top left hand corner to expand the Navigation Menu then select “Manage” to open the APIs list.

Portal_Home.png

In the list of available APIs click the “Import API” button. This will bring up the Import API Wizard. Click Browse to navigate to where you saved the Spike Arrest .zip file saved in the previous section.

Import_API_Button.png

Import_Wizard.png

Select_Proxy.png

Import_OK.png

With this, the API Proxy should now appear on your list of APIs, already deployed, and replete with Documentation. Select the API Proxy name (SpikeArrest) to enter the API Proxy for access URL and details.

Imported_API.png

This will open the details of the API Proxy, including the API Proxy URL, used to connect to the API Proxy, the Target Endpoint details, which provides the data, description/documentation and more. Before actually hitting the API Proxy, let’s look at the pre-configured Policies that make it possible. Click the “Policies” button.

Open_Policies.png

This will enter the Policy Editor screen, which you can use to Add/Edit/Delete policies on an API Proxy. For this sample proxy, there will be only one policy added, the SpikeArrest Policy. To view it, on the far left select “Preflow” under “Proxy EndPoint” and then click the “spikearrest” icon in the Incoming Request flow.

Note the simple code is currently configured for Rate of 2pm. This means an average of 2 requests per minute. Refer to documentation for more on the available options.

SpikeArrest_Policy.png

Now to test the API Proxy, and see this policy in action, click the left arrow <- in the corner to return to the API Proxy screen. In this screen, copy the API Proxy URL. Open a new Browser Tab and paste the URL there to access.  Then refresh the page 2 more times, on the 3rd try you should receive an error from the Spike Arrest policy saying you are attempting to access the Proxy too quickly.

Copy_URL.png

Here you will need to provide your ES4 credentials (if you do not have them, use the link at the top to sign up).

ES4Credentials.png

Refresh the page 2 more times.

SpikeArrest_Success.png


On the 3rd try you should receive an error from the Spike Arrest policy saying you are attempting to access the Proxy too quickly

SpikeArrest_Error.png

So with only a few clicks you have successfully pulled a working API Proxy into your landscape! Remember you can also go back into the Policy and edit the code, to try out changing the sample code as well (and if you mess anything up too badly, you can just delete it and re-import the sample code).

Wrap Up

With this, we hope that you can see the utility of using the API Proxy sample repository. Example policies, sample code, documentation, and a working, configurable proxy to understand more quickly how to utilize SAP API Management with your systems.
I recommend this as a starting point to quickly view API Proxies in action, then apply what you learn to creating your own API Proxies.

The intention is to continue to provide more and expanded content via GitHub in a flexible manner, so please continue to check the repository. You may also provide suggestions about content that would be helpful to understanding API Management usage on the community, or via E-Mail.

For additional information: SAP API Management – Overview & Getting started

To report this post you need to login first.

6 Comments

You must be Logged on to comment or reply to a post.

  1. Sven Huberti

    That is absolutely a great addition! 😎

    Will it also be possible to import GitHub policies directly from within API Management? For instance, when you click on the “+” icon, you can directly select the available GitHub policies?

    Linking to your own GitHub repository would also be fantastic, so that you can share and re-use your own policies.

    (0) 
    1. Elijah Martinez Post author

      Hi Sven,
      Thank you for the question, those are definitely good ideas, though they are not supported as of today. If usage/demand is sufficiently high, this may be an item that can be incorporated into the design time.

      There are some other updates that are coming up which may partially fill this concept as well, but for now they are in the works… 🙂

      Regards,

      Elijah

      (0) 

Leave a Reply