DEV Community

Mariela Dimitrova for Software AG Tech Community

Posted on • Originally published at tech.forums.softwareag.com on

API Monetization with API Gateway and API Portal

Introduction

API Monetization is the ability to produce revenues from the consumption of APIs. Knowing how to make money with APIs can help in realizing the business goals.

Participants in the API value chain

image

API Monetization can help to create new revenue opportunities for the organization, provides insight about customer behavior, building customer loyalty and to stay relevant and maintain a competitive edge in the marketplace.

API monetization models

image

webMethods API Gateway offers API Monetization through creation of API Packages and API Plans.

An API Package refers to a logical grouping of multiple APIs from a single API provider. A package can contain one or more APIs and an API can belong to more than one package.

An API Plan is the contract proposal presented to consumers who are about to subscribe to APIs. Plans are offered as tiered offerings with varying availability guarantees, SLAs or cost structures associated with them.

An API package can be associated with multiple plans at a time. This helps the API providers in providing tiered access to their APIs to allow different service levels and pricing plans.

API Providers can create the API Packages and Plan in the API Gateway. Whereas API Consumers can subscribe to the API Package from the API portal and start consuming the API.

Audience

This document is intended to the API providers who wants to implement the monetization for the APIs hosted on the webMethods API Gateway. Document also explains how API consumers can subscribe for the API Packages and consume the APIs from API portal.

Pre-Requisites

Use Case

Let’s see, how we can implement API Monetization for the below use case.

“A leading telecommunications organization, has developed few communications APIs like SMS, WhatsApp etc., which can be consumed by third party developer group for implementing features like sending SMS, sending WhatsApp etc., to the end users”

As an API Provider , below are the steps to create the API Package in webMethods API Gateway.

In the below sample, we will show the creation of API Packages and API Plans for SMS API with the ability to send SMS to consumer.

image

Step 1: Click on the “Packages” in the title navigation bar and click on “Create”

image

Step 2: Select Package from the list of choices and click on “Create” option.

image

Step 3: Provide details of Package Name, version, description. Select the desired icon to represent your package.

In the below screenshot we have created the package with name “CommunicationsPackage”

image

Click on “Continue to add plans” if there are already existing plans to associate with this package. API Plan can also be created in later stage and then can be associate with the API Package.

In this example we will create the Plan later and then associate it with the “CommunicationsPackage”

Step 4: Associate SMS API to the “CommunicationsPackage”

Type characters in the search box and click the search icon to search for the required APIs. A list of APIs that contain the characters specified in the search box appears.

Select the required APIs to be associated with the Package and click + to add them. And click on “Save”

image

image

Step 5: Create Plans by going back to “Packages” in the title navigation bar. Click on “Create”

image

Step 6: Select “Plan” and click on “Create”

image

Step 7: Provide details like Plan Name, Version, Description, suitable Icon for your plan.

In the below screenshot, we will create Plan named _ “SMS Plan” _

image

Click on “Continue to add pricing” to add the pricing configurations.

Provide the details like Cost for the plan, terms of conditions for the pricing and license details

image

Click on “Quality of Service” to specify rate limits and quota.

For specifying the rate limits, click on “Add Rule”. Rate limit helps to specify the maximum number of requests supported in specified period. This is for applying the throttling rule.

image

Specify the Violation message to be displayed to the consumer if the rate limit is exceeded.

image

For specifying Quota, provide details like maximum number of requests allocated in the plan for a specified period.

image

“Block on Breach” option can be enabled, which will block access to the API after it exceeds the specified quota.

image

Notification settings can be also be configured, which will help to send the notification proactively once the total request count reaches the % value as provided in the maximum quota value. This will help to minimize the disruption in the service when the API invocations exceeds the allocated quota.

image

Once all the configuration is done, click on Save button for saving the plan.

image

Step 8: Associate “SMS Plan” to the “CommunicationsPackage” package.

Navigate to “Package” in the title bar, select the package “CommunicationsPackage” and click on Edit.

image

Navigate to the “Plans” section in the left-hand side menu and select the required plan “SMS Plan” and click on Save

image

Once the package is associated with the plan, activate the package.

image

Step 9: Package and plan subscriptions can be done only through API Portal. To achieve this, publish Package “CommunicationsPackage” and associated API to API portal.

Click on the Publish icon present next to the “CommunicationsPackage” to publish to API portal.

image

Select the API Portal Community to which package needs to be published and click on “Publish”

image

As an API Consumer, Below are the steps to consume the SMS API from API Portal

Step 1: Subscribe “CommunicationsPackage” package from API Portal

In API Portal, Click “API packages” in the title navigation bar. Here we can find the “CommunicationsPackage” published from the API Gateway.

image

Click on “Show details” to see the plan details associated with the package.

image

Click on “Subscribe” to get subscribed for the Package.

A dialogue to request for API access token appears. Provide the application details and click on “Request token”. This will create the application in API portal with the necessary token details to access the SMS API.

In the below example we are creating the application named “SMSApplication”

image

Token details can be found by clicking on the “Applications” present under the user option in the right-hand top corner of the screen.

image

image

Now we can consume the SMS API with this “SMSApplication” created.

Click on API Gallery in the title bar, and select “View Details” under the SMS API

image

Click on “Try API” present at the bottom of the screen.

image

The “SMS Application” created while subscribing the “CommunicationsPackage” will be present in the left-hand side and the token details are added automatically in the Headers section.

image

Provide the required payload in the Body section and click on Send to test the SMS API

image

image

Once the throttling limit is exceeded, below error will be sent from the API Gateway.

image

For more details please refer the documentation site https://documentation.softwareag.com/

Read full topic

Top comments (0)