Trying to delete an API from WSO2 API Manager and end up seeing this error – Cannot remove API as active subscriptions exist? Well, the error message clearly indicates that there are some users subscribed to the API and it’s not possible to delete the same. It means, before you can remove an API, you need to unsubscribe the users from it. Surprisingly, WSO2 does not provide a facility for the admin or publisher to unsubscribe the users from an API. Instead, you need to perform either of the below options:
- Contact your users and request them to unsubscribe from an API you wish to delete.
- Or Execute a few MySQL queries to remove the subscriptions to an API
How to view the users subscribed to the API?
- Login to the Publisher portal
- Click on the API for which you would like to view the subscriptions.
- Click on
Subscriptionsfrom the left sidebar.
- Look out for the list of subscribers under the “
Manage Subscriptions” heading.
How to contact subscribers?
Click on the
Contact Subscribers button located next to the”
Manage Subscriptions“. This will open the mail client to send an email to the subscribers.
How to unsubscribe to an API via the developer portal?
Log in to their developer portal account and click on the “
Applications” menu located on the header. Click on the application to view the APIs to which you had subscribed.
On the application page, click on “
Subscriptions” from the left sidebar. Here, you can either change your subscription or delete it.
Alternatively, log in to the developer portal, click on the API you wish to unsubscribe. Then, click on the “
Subscriptions” menu from the left sidebar and click the “
UNSUBSCRIBE” link located in the application row as shown below.
That’s it! Once all the users are unsubscribed to the API, you can log in to the publisher portal and delete the API successfully.
Well, contacting each user and asking them to unsubscribe to the API would be a hard task. But there’s no facility for the admin or the publisher to remove the users subscribed to the API. However, the other way of removing subscriptions is via SQL queries described in this article. But wait, I did try those steps and ended up seeing “Unable to list APIs” error on the developer portal (probably I would have missed some step or made some mistake). Hence I suggest not to mess with the database unless you know what you are doing.