- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
How to specify two IPv4addr's in the dhcpmember JSON payload
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-16-2020 07:41 AM
Hi Infoblox community,
I am looking to utilize an API call to PUT two members within the DHCP member assignment field. Here is my code in python:
import requests
import json
import sys
import getpass
import pprint
requests.packages.urllib3.disable_warnings()
infoblox = "https://X.X.X.X/wapi/v2.10.1/network/eF5zLm5ldHdvcmskMMAuMTM0LjE00C4wLbI0LzA:X.X.X.X/X/default"
payload = '{"network":"10.X.X.X/X","members":[{"_struct":"dhcpmember","ipv4addr":"1.1.1.1"}]}'
headers = {"Content-type": "application/json", "Accept": "application/json"}
id = 'username'
pw = 'password'
valid_cert = False
response = requests.request("PUT", infoblox, data=payload, headers=headers,
auth=(id, pw), verify=valid_cert)
if response.status_code != requests.codes.ok:
print(response.text)
exit_msg = 'Error {} OBJ REF OR PARAMS ARE WRONG: {}'
sys.exit(exit_msg.format(response.status_code, response.reason))
results = response.json()
pprint.pprint(results)
My question is how do I specify another IPv4address (lets say 2.2.2.2) in the JSON payload field: [{"_struct":"dhcpmember","ipv4addr":"1.1.1.1"}]} so that I can have both 1.1.1.1 and 2.2.2.2 in the 10.X.X.X/X network's member assignment?
Solved! Go to Solution.
Re: How to specify two IPv4addr's in the dhcpmember JSON payload
[ Edited ]- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-20-2020 07:03 AM - edited 07-20-2020 07:04 AM
Hello again Infoblox community,
I opened a support ticket with Infoblox and worked with an Engineer who was able to provide an answer to my question! Kudo's to that Engineer!
Here is the syntax for specifying two IP's in the member assignment field using API (I wrote this in Python so if you're using cURL, it may be a bit different):
'{"network": "10.X.X.X/X", "members":[{"_struct":"dhcpmember","ipv4addr":"1.1.1.1"},{"_struct":"dhcpmember","ipv4addr":"2.2.2.2"}]}'
so basically, it's just a matter of adding a comma and then another {"_struct"} statement.