Skip to Content

This blog would continue with the last post and would discuss the Governance and Monetizing of APIs

Govern the API

Go to the as SAP Cloud Platform Trial Account->Services->Integration->API Management. If this is disables,please enable it ->Access Api Portal-

Inside the Api Portal on the left panel go to  ‘Develop‘ ->Api Providers->Add API Provider

 

Once the Api Providers are created, the Api proxy can be created.

Now go to API->Create and enter the details of the endpoint/odata service that we created in the previous tutorial. ->Press create once the details are filled and then deploy the Api.

 

Upon successful deployment of the API there would be a proxy url created. This proxy url is now the endpoint which would give the data. Use api_proxy_url+’/nutrientproxy/Nutrient’ to access the data through the proxy.

 

Now let’s add a api key to the proxy. This would secure the API and only authorized person would be able to access the data.

Inside the Api Created,click on policies.

 

Inside the policy template click on Preflow-> Then within the Policies ->Security Policies->Verify Api Key.

 

Once the key is added the following has to be added so that the api key becomes part of the query string

 

Update the policy,save and deploy the Api. Now try accessing the Api ,the Api should throw error.

{
  "fault": {
    "faultstring": "Failed to resolve API Key variable request.queryparam.apikey",
    "detail": {
      "errorcode": "steps.oauth.v2.FailedToResolveAPIKey"
    }
  }
}

 

Monetize the API -Creating product and assigning Rate Plans

Now lets create billing plans for the API.On the left panel ->click Monetize->Rate Plan->Create

Create any type of rate plan you want for the API.It can be a fixed plan or pay-per-use.

Next we create a product to assign this Rate Plan that we created.

Develop->Products->Create

Here add the ‘Nutrient Proxy’ in the APIs and add the ‘NutrientRatePlan’ Rate Plan.Publish the Product

 

At this point any authorized calls to the proxy would be metered and the number of calls would show in the Product.

 

The next step is to consume this API from Excel and generate a bill for the usage.

Access developer portal to create an application

 

Consume the API

Once the app is created there is option to see the api key .This api key enables the use of proxy Api which we created in the last  steps.Test the API in browser

‘https://sap_cloud_platform_trial_domain_name/nutrientproxy/Nutrient?apikey=API_KEY’.

Now lets consume the API-Proxy from excel sheet.

Use the Api to import the data into excel

 

Select the table

Create information from the data.

 

Now lets check the NutrientProduct to see the number of calls made to the API proxy

 

Generate Bills and check Consumption

 

Check the bills generated per application.

 

For the blog I demonstrated from the provision of the data within the HANA DB  to the consumption  and monetization of the APIs .However the scenario can also be achieved with any other database management systems(MongoDB,Cassandra,etc..) exposing any REST/OData services.

 

 

 

To report this post you need to login first.

Be the first to leave a comment

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

Leave a Reply