Saturday, February 28, 2015

How to delete API from publisher with active subscriptions - WSO2 API Manager.

WSO2 API Manager doesn't allow to delete  APIs from publisher  which contains active subscriptions. However if  you have strong requirement to delete such API you can follow the  bellow steps to remove it.

Lets say we have API with active subscriptions.

Name : MobileAPI
Context : /mobile
Version : 1.0.0

1.First we should change the lifecycle state to BLOCKED. Then that API will be invisible from store and no longer can invoke that API.

2. Browse the  AM database and find the API_ID.
SELECT API_ID FROM AM_API WHERE API_NAME ='MobileAPI' AND API_VERSION ='1.0.0' AND CONTEXT ='/mobile';

3. Delete all the subscriptions related to that API.
DELETE FROM AM_SUBSCRIPTION  WHERE API_ID IN(SELECT API_ID FROM  AM_SUBSCRIPTION  WHERE API_ID=? );
4. Now you can delete that API from publisher.