WSO2 API Manager : Sharing API Subscriptions between developers

Subscription management is a crucial part of an API Management solution. WSO2 API Manager provides this capability to API developers via the API Portal (API Store) or via exposed portal APIs. API subscriptions are associated with applications. An API needs to be subscribed under an application and the application can have one or many APIs subscribed to it. This application is a logical space that represent a real life application. Each application would have an associated API key through which the API Can be consumed, This concept can be explained with the following example.

 

Lets look at this from the perspective of a local met department which exposes a set of APIs for consumption. They would be using WSO2 API Manager to expose the APIs. Lets consider WeatherNow as a company that would build an app to provide weather information. WeatherNow would consume multiple APIs provided by the local met department to display weather information on the app.

 

 

They need access to multiple APIs exposed by the local met department in order to get this app up and running. The app would provide information on the temperature, rainfall, snowfall and wind speed of a given location. All these data are exposed as individual APIs by the Met department. Developers from WeatherNow would need to subscribe to the required weather APIs from the met department. WeatherNow would create an application in API Manager to do so. This is illustrated in the diagram below

 

sub1

 

This works perfectly if you have just one developer from WeatherNow to access the developer portal and subscriptions, but what if there are multiple developers from WeatherNow working on these APIs. They cannot create their own subscriptions but is required to share the same subscription with each other. WSO2 API Manager facilitate this capability via the API Store. It is possible to enable subscription sharing where developers in the same organization share subscriptions with the other developers belonging to the same organization.

Sub2

 

 

This capability is disabled by default in the API Manager and can be enabled by commenting the following in api-manager.xml (<API-Manager_Home>\repository\conf\api-manager.xml).

<GroupingExtractor>org.wso2.carbon.apimgt.impl.DefaultGroupIDExtractorImpl</GroupingExtractor>

 

This capability takes into account the claim name ‘Organization’ in the user store to group the users. The DefaultGroupIDExtractorImpl can be modified to consider any other claim to group the users.

Please note that the this default extractor doesn’t work with SAML SSO. You need to write a custom implementation using the WSO2ISGroupIdExtractor.java class as an example.

Advertisements

Bulk exporting of API’s in WSO2 API Manager

WSO2 API Manager is really powerful Opensource API Management tool that would allow you to expose, secure, manage and monitor API’s exposed via the API Manager. The product now comes with a nice feature to export/import API’s from and to the API Manager deployment. This feature comes in handy when you want to migrate API’s from one environment to another or when you want to copy an API from one API Manager to another. The feature is exposed as a RESTful API that can be invoked from a REST client, CuRL or a 3rd party script.

The limitation of the current implementation is that it only allows a single API to be exported at once. This is fine for majority of use-cases but there may be some instances where you may have 100’s of API’s and it might not be practical to export each and every API individually. To avoid this situation I have written the following tool that would allow you to do a Bulk export of API’s from the API Manager. The code and the instructions on how to use this tool can  be found in the following GIT repo.

https://github.com/nadeesha5814/APIBulkExport