Reply

Reclaim an IP with API

Member
Posts: 2
363     0

Hello,

 

I've been trying to nail down an API call that will function similarly to the 'reclaim' button in the UI itself.

 

I need it to remove the IP, plus any DNS records associated with it.  A records, CNAMEs, everything, as part of a server decomissioning process.

 

This is the call I think will work:

DELETE  - https://[infoblox server]/wapi/v2.4/ipv4address?ip_address=[IP]

 

I'd like to check that this is not going to delete the network it is within also, as it is listed in the body of a get request to the same URL.

 

Any guidance here would be appreciated.

 

Thanks!

 

 

Re: Reclaim an IP with API

Community Manager
Community Manager
Posts: 144
363     0

Yes sounds like that will work for your needs.  Recliaming the IP will delete any DNS records or DHCP objects from that IP address.  It will not remove or expire DHCP leases. 

 

You'll need to obtain the _ref for the IP address, and then run the DELETE against the reference.

 

you can do it in one action with a multibody request:

 

POST

[
  {
    "method":"GET",
    "object":"ipv4address",
    "data": {"ip_address": "10.102.3.106"},
    "assign_state": {"ipaddr_ref": "_ref" },
    "enable_substitution": true,
    "discard": true
  },
  {
    "method":"DELETE",
    "object": "##STATE:ipaddr_ref:##",
    "enable_substitution": true
  }
]

 

 

 

Re: Reclaim an IP with API

Member
Posts: 2
363     0

Thanks, that's really helpful.

 

I'm relatively new to APIs in general so I haven't seen multibody requests before.

 

It processes the GET first, then populates the DELETE object field afterwards with the ipaddr_ref result?

 

Thanks!

Showing results for 
Search instead for 
Did you mean: 

Recommended for You