Infoblox’s global team of threat hunters uncovers a DNS operation with the ability to bypass traditional security measures and control the Great Firewall of China. Read about “Muddling Meerkat” and the many other threat actors discovered by Infoblox Threat Intel here.

API & Integration, DevOps,NetOps,SecOps


How to specify two IPv4addr's in the dhcpmember JSON payload

New Member
Posts: 2
2458     0

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


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":""}]}'
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 !=
exit_msg = 'Error {} OBJ REF OR PARAMS ARE WRONG: {}'
sys.exit(exit_msg.format(response.status_code, response.reason))

results = response.json()

 My question is how do I specify another IPv4address (lets say in the JSON payload field: [{"_struct":"dhcpmember","ipv4addr":""}]} so that I can have both and in the 10.X.X.X/X network's member assignment? 

Re: How to specify two IPv4addr's in the dhcpmember JSON payload

[ Edited ]
New Member
Posts: 2
2459     0

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":""},{"_struct":"dhcpmember","ipv4addr":""}]}'


so basically, it's just a matter of adding a comma and then another {"_struct"} statement. 



Showing results for 
Search instead for 
Did you mean: 

Recommended for You