Are you interested in our Early Access Program (EAP)? This program allows you to preview code, test in your lab and provide feedback prior to General Availability (GA) release of all Infoblox products. If so, please click the link here.

API Examples

Reply

Looking for API info on adding "DHCP -> Shared Networks" and other Infoblox objects

Member
Posts: 4
635     0

GitHub - infobloxopen/infoblox-client: Infoblox NIOS Python WAPI Client or

Seem to be the only place I can find documentation I'm using these Infoblox objects. Any additional information would be appreciated. I would like to see some examples of what the parameters might look like for different objects.

 

Primarily using Python but some JavaScript React.

 

Thanks in advance.

 

Re: Looking for API info on adding "DHCP -> Shared Networks" and other Infoblox objects

Moderator
Moderator
Posts: 246
636     0

The best way to create your own examples is to create something once in the GUI, and use WAPI to see what the JSON looks like.  Turn it into a REST call, modify the JSON payload appropriately, and send the JSON as a new call.

In general, POST is for creating new stuff and PUT is for modifying existing stuff using the _ref.

Create a shared network, using the _ref for each network to be added:

curl -k1 -u admin:infoblox -X POST 'https://192.168.1.2/wapi/v2.11/sharednetwork' -H "Content-Type: application/json" -d \
'{
	"name": "my_shared_network", 
	"network_view": "default", 
	"networks": [
		{
			"_ref": "network/ZG5zLm5ldHdvcmskMTkyLjE2OC4xLjAvMjQvMA:192.168.1.0/24/default"
		}, 
		{
			"_ref": "network/ZG5zLm5ldHdvcmskMTkyLjE2OC4yNTUuMC8yNC8w:192.168.255.0/24/default"
		}
	]
}'

returns the _ref of the shared network:

"sharednetwork/ZG5zLnNoYXJlZF9uZXR3b3JrJG15X3NoYXJlZF9uZXR3b3JrLjA:my_shared_network/default"                         


Define the DHCP options (lease tine & dns servers) on a shared network:

curl -k1 -u admin:infoblox -X PUT 'https://192.168.1.2/wapi/v2.11/sharednetwork/ZG5zLnNoYXJlZF9uZXR3b3JrJG15X3NoYXJlZF9uZXR3b3JrLjA:my_shared_network/default' -H "Content-Type: application/json" -d \
'{
	"options": [
		{
			"name": "dhcp-lease-time", 
			"num": 51, 
			"use_option": true, 
			"value": "259200", 
			"vendor_class": "DHCP"
        }, 
		{
			"name": "domain-name-servers", 
			"num": 6, 
			"use_option": true, 
			"value": "192.168.1.2,192.168.2.2", 
			"vendor_class": "DHCP"
		}
	]
}'

returns the _ref of the shared network again:

"sharednetwork/ZG5zLnNoYXJlZF9uZXR3b3JrJG15X3NoYXJlZF9uZXR3b3JrLjA:my_shared_network/default"

Re: Looking for API info on adding "DHCP -> Shared Networks" and other Infoblox objects

Member
Posts: 4
636     0

Thank you. This is helpful. I'm surprised there is not an infoblox-client built with JavaScript/Node.js.

Showing results for 
Search instead for 
Did you mean: 

Recommended for You

Businesses are investing heavily into securing company resources from cyber-attacks form cybercrimin