You may be thinking, hey Sandro, what the hell? That is basic information and a straightforward task. Why do you want to write about that?
Indeed it is, and you are right that it is an effortless and straightforward operation, at least at first glance. But like most things, nothing is that simple if you look closer. But let me explain better.
Let’s imagine that we have an API call MoniorBizTalkPorts. It wasn’t enough that I had a spelling mistake, but I already exposed that Logic App in the other API that you see in the picture below and that I explained in detail in the previous blog post.
To delete or remove the MoniorBizTalkPorts API, we need to
- Select the API, click … (3 dots) and choose Delete.
- An on the delete confirmation pop-up click Yes.
And indeed, the API was removed and no longer available.
So what is wrong with this process? The quick response to that question is, nothing is wrong, just incomplete.
And the same happens for an operation, so if you take for example the BizTalk Alerts API, and you want to delete an operation the steps will be similar:
- You need to select the API, and on the operation, click … (3 dots) and choose Delete.
But by doing only these basic tasks, you will be leaving a lot of trash on your API Management resource.
Deleting Named values
The proper way to do it is also cleaning the additional components that the exportation wizard adds for you automatically, especially the Key-Value pairs on the Named values inside your APIM. Each API Management service instance has a collection of key/value pairs called named values that are global to the service instance.
These Named values or Key-Value pairs created automatically with the import wizard are easy to find since they all start with the API name. As you see in the picture below:
- The first three lines marked reference to the API: BizTalk Alerts API
- And the second two lines marked reference to the API: MoniorBizTalkPorts
In fact, you see two key-value pairs related to the MoniorBizTalkPorts API because it was garbage already accumulated from previous tests.
You need, or you should delete all of this obsolete and unnecessary information by click … (3 dots) on the key-value pair and choose Delete.
But another essential resource you need or you should delete is Backends. These are also created automatically for you by the import wizard. This will have, among other attributes, the Runtime URL for your Logic Apps.
As you may see in the picture below, although I delete the API, the back end is still available. Once again, you see two backends related to the MoniorBizTalkPorts API because it was garbage already accumulated from previous tests. You will also notice they point to the same URL.
Like what we did with the Named values, you should click … (3 dots) on the backend we want to delete and choose Delete.
As you can see, even a simple operation like deleting a Logic App exposed as an API, done correctly, is more complicated or requires more work than it initially seems.