Reclaim IP in NSX via API

One of the more tedious things in dealing with NSX is to reclaim an IP address that is no longer in use. Here is a method I use with Postman and the NSX API.

reclaim ip in nsx
Sorry, our pool is full.. come back later.

Setup your Authorization to use you NSX Manager username and password:

nsx api postman authentication

Next, perform a GET request to your NSX Manager:

GET  https://nsxmgr01.lab.local/api/2.0/services/ipam/pools/scope/globalroot-0

This will output something similar to this:

nsx api scope

Locate the IP Pool where the IP you are looking to reclaim lives. In my example, I need to get rid of 192.168.64.29 which is under ipaddresspool-12. We can now run a DELETE to remove the IP:

DELETE https://nsxmgr01.lab.local/api/2.0/services/ipam/pools/ipaddresspool-12/ipaddresses/192.168.64.29

As an alternative to using something like Postman, you can always leverage PowerShell for your API calls. Here’s a post to get you started with authentication to the NSX Manager.

Leave a Reply

Your email address will not be published. Required fields are marked *