- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
API call to remove options
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-11-2019 11:42 AM
Hi All-
I am able to retrieve network and DHCP range objects as well as DHCP option values using basic API calls and reference values. So I have a call like this:
h t t p s://1.2.2.1/wapi/v1.2/range/ZG5zLmRoY3BfcmFuZ2UkMTAuMTMuMTIuMTAwLzEwLjEzLjEzLjI1MC8vLzAv:10.13.12.100/10.13.13.250/default/?_return_fields%2B=options
And I get:
{
"_ref": "range/ZG5zLmRoY3BfcmFuZ2UkMTAuMTMuMTIuMTAwLzEwLjEzLjEzLjI1MC8vLzAv:10.13.12.100/10.13.13.250/default",
"comment": "Test Range",
"end_addr": "10.13.13.250",
"network": "10.13.12.0/23",
"network_view": "default",
"options": [
{
"name": "vendor-encapsulated-options",
"num": 43,
"value": "F1:04:01:02:03:05",
"vendor_class": "DHCP"
},
{
"name": "dhcp-lease-time",
"num": 51,
"use_option": false,
"value": "43200",
"vendor_class": "DHCP"
}
],
"start_addr": "10.13.12.100"
}
which is great - these are the parts of the range that are different from the netwok. I would like to get rid of the option 43 value. Every time I try to post anything back I seem to delete the entire range, which is not what I want to do. I have tried to put back various null values to no avail - this was just a guess.
I just want to get rid of the dhcp option for the range so it reverts back to the inherited value from the network. How can I accomplish this via API?
Re: API call to remove options
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-14-2019 07:57 AM
Update the existing range with a PUT action, and set the options to an empty array, using square brackets with nothing between them.
Here's an example with curl, using JSON formatting for the body:
curl -k1 -u admin:infoblox -X PUT "https://192.168.1.2/wapi/v2.1/range/ZG5zLmRoY3BfcmFuZ2UkMTAuMTMuMTIuMTAwLzEwLjEzLjEzLjI1MC8vLzAv:10.13.12.100/10.13.13.250/default" -H "Content-Type: application/json" -d '{"options": []}'
Re: API call to remove options
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-19-2019 04:57 AM
Hi-
Thanks for your response. This worked well to remove all of the options. Is there a way I can remove a single option like option 242 or option 150?
Re: API call to remove options
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-19-2019 06:09 AM
When you change the options, you have to send back the full set of desired options. So you would need to request the array containing the full list of options, then process the array to remove the unwanted option, and then write back the array in a "put" command.
Re: API call to remove options
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-19-2021 09:07 AM
Why not have an options+ or options- args, similar to the EA or ipv4addr?
Re: API call to remove options
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-27-2021 01:31 PM
Hi,
As of now, "options" does not support +/- like extattrs or ip4addr.
Regards,
Krishna Vasudevan
Re: API call to remove options
[ Edited ]- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-17-2021 12:53 PM - edited 12-17-2021 02:37 PM
thanks for the advice