The latest version of WSO2 API Manager v 3.1.0 is equipped with many useful features and improvements such as – Integration with AWS Lambda, a recommendation system for API store by analyzing the behavior of the developer application, Graphical tryout Console for Developer Portal, API security Audit integration and an API categories feature to enable API providers to categorize their APIs and many more. For the purpose of this blog, we will focus on API categories feature.
In WSO2 API Manager 3.1.0, you can define and use API categories to group APIs belonging to the same category in terms of functionality / usage / teams, et cetera for improved user experience. First, you need to define API categories in the Admin portal, and they will be made available in the Publisher for assigning them to APIs as part of the design configuration. Once the categorized API gets published to the Developer Portal, they appear as a clickable link to users, which makes it easy for consumers to consume APIs by checking the category of their interest.
Note: In the previous version of WSO2 API Manager 3.0.0, the grouping of APIs was a bit cumbersome using tag-wise groups. API tags had naming constraints where tags need to be defined with the suffix ‘-group’ in order for them to be treated as tag-wise groups in the developer portal, and tag-wise mode had to be enabled in order to display APIs in a grouped manner on the developer portal.
Below are steps to define the API category and associate API to categories.
Step 1: Add an API Category
Admins can add an API category by using the Admin Portal UI or the Admin REST API.
Add an API category using the Admin Portal UI
- Sign in to the Admin Portal: https://localhost:9443/admin
- Click API Category and then click API Categories.
- Click Add New Category.
- Enter a name and a description for the category.
- Click Save.
You can also use the curl command to add API category to Admin portal:
curl -k -X POST -H "Authorization: Bearer <ACCESS_TOKEN>" -H "Content-Type: application/json" https://localhost:9443/api/am/admin/v0.16/api-categories -d @category-data.json
Sample payload
{ "name":"Sales", "description":"Sales Category" }
Step 2- Attach the API Category to an API
- Sign in to the Publisher: https://localhost:9443/publisher
- Click on an API.
- Click Design Configurations.
- Select the API category.
- Click Save.
Step 3 – List APIs in Developer Portal
- Sign in to the Developer Portal:https://localhost:9443/devportal
- Expand the Tag Cloud menu.
- Click on the specific API category under API Categories to display APIs belonging the selected category
Summary
WSO2 APIM 3.1.0 provides the feature for grouping APIs into categories. API categories are helpful for users and developers as well for improved user experience and for a better organization, specifically when you have a large number of APIs to manage. You can now create API categories and apply them to APIs in a few simple steps. Try it out and let us know how it’s working for you.
If you have any questions on this feature or on any other topic of WSO2 API management, please leave a comment below or contact us.