Managing an API Life Cycle
While an API is the published interface, a corresponding service running in the back-end handles its actual implementation. APIs have their own life cycle, independent from the back-end service they rely on.
The following stages are available in the default API life cycle:
- CREATED: API metadata is added to the API Subscription and Usage, but it is not visible to subscribers yet, nor deployed to the API Gateway.
- PUBLISHED: API is visible in API Store, and eventually published (if the "Propagate Changes to API Gateway" option is selected at publishing time).
- DEPRECATED: API is still deployed into API Gateway (available at run-time to existing users) but not visible to subscribers. An API can automatically be deprecated when a new version is published.
- RETIRED: API is unpublished from the API gateway and deleted from the store.
- BLOCKED: Access is temporarily blocked. Run-time calls are blocked and the API is not shown in the API store anymore.
The API life cycle is exposed in the API publisher's end-user Web interface and is only visible to and manageable by a user who is assigned the "publisher" role. For instructions on creating a user with the "publisher" role, refer to section User Management.
As an example of API life cycle management, let's take a look at how to publish an API using the API Publisher.
Publishing an API
1. Log in to WSO2 API Publisher as a user who has been assigned the "publisher" role. For example,
2. From the "All APIs" window that opens, click on the API you want to publish.
3. The API's information will be shown. For example,
4. Select the tab named "Life Cycle." Information on the APIs state will be shown as follows:
Note
The tab "Life Cycle" is only visible to users with "publisher" privileges.
5. To publish the API, select the PUBLISHED state from the drop-down list.
Three options will be available for selection as follows:
Propagate Changes to API Gateway
Used to define an API proxy in the API Gateway runtime component allowing the API to be exposed to the consumers via the API Gateway. If this option is left unselect, the API metadata will not be changed and the API gateway will have to be configured manually according to the information published in the API Subscription and Usage.
Deprecate Old Versions
If selected, any prior versions of the API will be set to the "DEPRECIATED" state automatically.
Require Re-Subscription
Invalidates the current user subscriptions, forcing users to subscribe again.
6. Select the necessary options and click the "Update" button.
The API is now published and visible to consumers in the API Subscription and Usage. The API life cycle history will be visible at the bottom of the page as follows: