API Lifecycle Management
This sample demonstrates how to manage the lifecycle of an API.
Use case
Ability to run full lifecycle API Management from the inception stage of an API until it's retirement.
Notification mechanisms for informing developers on API changes.
Application lifecycle management mechanisms in sync with API lifecycle management.
Introduce and execute organization specific lifecycle states.
Business story
The API lifecycle is one of the key factors in API development. An API lifecycle has predefined states. These states represent the stages that an API has in the process of starting to develop an API until it's retirement. The following is a diagram that describes the current states of an API lifecycle.
API lifecycle states
State | Description |
---|---|
PUBLISHED | The API is ready to be used by users in the API Store. |
CREATED | The API has been created, but it is not available for usage. |
PROTOTYPED | An API prototype is created for the purpose of early promotion and testing. You can deploy a new API or a new version of an existing API as a prototype. It gives subscribers an early implementation of the API that they can try out without a subscription. |
BLOCKED | The API is temporarily blocked from being used. A publisher can publish the API from the BLOCKED state. |
DEPRECATED | The old version of the API is DEPRECATED when a newer version of the API is created and PUBLISHED. |
RETIRED | The API is no longer in use and has been moved to the RETIRED state. |
Business use cases
Assume that ABC is a mobile phone manufacturing company that needs the following:
- Employee salary details
- Employee personal details
- Available stock details
- Produce sales promotions
- Stop offering promotions when they capture the market
How can this business scenario be achieved using WSO2 API Manager?
Separate APIs are required for the following scenario:
API needs to get employee salary details while in the PUBLISHED state.
API to the is still not published which is in created state to get employee personal details in CREATED state
Old API to get available Stock details in DEPRECATED STATE
A New API version of the API which is to get available Stock details PUBLISHED state
API to produce sales_promotions which will be in PUBLISHED state and BLOCKED state when there are no promotions available.
API developers must get notifications when a specific API is promoted to published state. This point is by subscribing to the lifecycle state change notification. How to subscribe will be explained below.
For delails on how to enable notifications, see Enabling Notifications.
Follow the steps below to configure API lifecycle state notifications.
- Login to carbon console (https://<hostname>:9443/carbon).
- Select API media type.
- Select the API from the list.
- Go to the API resource and add a subscription to Change_LC_State.
- Now you will be getting notifications for the API you have subscribed.
The API to produce sales promotions will be in REJECTED state once the organization decides there will be no longer promotions available in future (since we need to represent the sales promotions when the API is in the BLOCKING state as well, we are creating a new API sales_promotions_2 to represent the REJECTED state).
Running the sample to populate the sample data
Go to <API-M_HOME>/sample-scenarios. Execute the run.sh file. Enter the scenario number as 7, when prompted.
After running the sample two APIs in different states (PUBLISHED and BLOCKED) will be created. Note that both APIs have the same name.