WSO2’s API Manager supports the Monetization of API’s. In layman’s terms: it allows you to make money with the API’s you or your organization are offering.
For many organizations, monetization is not something they would consider. Governments often offer a service to the public with their API’s. However, API’s can have real value for people or organizations, so much even that they are willing to pay for it. In the Netherlands, the ‘Kadaster’ collects and registers administrative and spatial data on property and the rights involved. Part of the information is free, part is paid. If you want to know what a house has sold for, you can text them with with the zipcode / house / apt number and get the last know sales price. This is only EUR 1.50 and for house buyers this can be valuable information.
So information can be valuable and offering it via API’s can help you make money. So how would you do that using the WSO2 API Manager? In this multipart blog we will help to setup a complete billing environment, show the flow from the API manager to the billing engine and show you how to make money with APIs.
A lot to do
Since this is a bit of configuration, we split the work into a number of blogposts. In this first blog we look at the subscription tiers and how we create an API that users need to pay for.
We will take an out of the box API Manager 2.1.0, install it on Windows (Linux is ofcourse also possible) and work from there. We also deploy the sample PizzaShack API.
Step 1 Turn on Monetization
First thing to do is to turn on monetization. Without this the labels (see further in this blogpost for the intended labels) on the API Store will not be shown. The current API Manager requires you to change the configuration file tenant-conf.json
manually
, rather then through a specific screen.
We make the changes through the registry browser of the API Manager. So we go the the Management UI of the API Manager (log in on the API Manager for instance https://localhost:9443/carbon) and browse the registry. In the tree select:
- _System
- Config
- Apimgt
- Applicationdata
- Apimgt
- Config
And select edit as text the tenant-conf.json file.
Change the EnableMonetization to true as shown below:
{
“EnableMonetization” : true,
“IsUnlimitedTierPaid” : false,
“ExtensionHandlerPosition”: “bottom”,
“RESTAPIScopes”: {
“Scope”: [ …..
If you want the UnlimitedTier to be paid as well, set IsUnlimitedTierPaid to true as well. In order to make the changes permanent, click on Save Content and restart the API Manager.
Step 2 Defining throttling tiers
Let’s add a tier that is commercial. This is done in the admin dashboard of the API Manager (https://localhost:9443/admin) . You add a tier using the button ADD TIER as shown in the bleu bar near the top of the “Subscription tier” screen in the Throttling Policies section.
When we click that we are able to enter details about the new tier. Most fields are self-explanatory but some might need some explanation.
General Details | |
Name * | Name of the Tier (no spaces allowed) |
Description | Description of the Tier |
Quota Limits | |
Request Count / Request Bandwidth | Determines the type of limit |
Request Count * | |
Unit Time * | Minutes / Hours / Days / Weeks / Years |
Burst Control (Rate Limiting) | What is the peak that is allows |
Request Count | How many requests ? |
Policy Flags | |
Stop On Quota Reach | Yes / No, allows for a model that extra invocations at a additional fee |
Billing Plan | Free / Commercial |
Custom Attributes | Allows you to add custom attributes to the tier |
Permissions | |
Roles * | Defines the roles for which this tier is |
This tier is … for above roles. | Allowed /Denied |
Determining the label
With the EnableMonitization set to true we will actually see labels in the API Store. There are the possible labels for an API:
- Free
- Freemium
- Paid
The label that is used is determined by the tiers that are selected when the API is defined.
Let’s look at the three possibilities. We deployed the sample API in API Manager 2.1.0 (PizzaShack) and make changes in the definition.
All free tiers
If we select only free tiers like in the picture below, we get a FREE label on the API.
Mixed tiers
When we mix free and paid tiers we get a FREEMIUM label in the API Store.
Only commercial tiers
If the tiers on the API are all commercial the API will be labeled with a PAID label.
Subscribing on a PAID Tier
Now we have a commercial tier with labels on the API. In the next blog we will go to step two on Monetization, setting up the monetization with a sample backend and so on.
If you have any questions about this blogpost contact us via the comments section of this blog. View also our WSO2 Tutorials, webinars or white papers for more technical information. Need support? We do deliver WSO2 Product Support, WSO2 Development Support, WSO2 Operational Support and WSO2 Training Programs.