- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
Please help : Creating multiple IP records at one go
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-13-2019 06:31 AM
Hi everyone,
I have a question. Is there any way by which i can create multiple IP records in infoblox using a single API call.
For example
IP Address Device name
--------------- ----------------
142.182.50.11 DMOKOO
142.182.50.14 DMOKO1
:
:
:
14.182.50.23 DMOC23
Can I send the IP address and hostname in one single API call to be saved in Infoblox as different IP records?
Please help
Re: Please help : Creating multiple IP records at one go
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-13-2019 06:40 AM
Yes you can do a "multiple body" request. This example is for DHCP reservations:
curl -k1 -u admin:infoblox -X POST 'https://192.168.1.2/wapi/v2.8/request' -H "Content-Type: application/json" -d \ '[{ "method":"POST", "object":"fixedaddress", "data": { "name": "host001", "comment": "This is a comment for Host 001", "mac": "00:00:00:00:00:00", "ipv4addr": "10.102.109.1" } }, { "method":"POST", "object":"fixedaddress", "data": { "name": "host002", "comment": "This is a comment for Host 002", "mac": "00:00:00:00:00:00", "ipv4addr": "10.102.109.2" } }, { "method":"POST", "object":"fixedaddress", "data": { "name": "host003", "comment": "This is a comment for Host 003", "mac": "00:00:00:00:00:00", "ipv4addr": "10.102.109.3" } } ]'
Re: Please help : Creating multiple IP records at one go
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-13-2019 07:33 AM
Thanks Richard
Re: Please help : Creating multiple IP records at one go
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-10-2020 01:00 PM
By any chance, could you provide an example of this using Python "requests" module?
Thanks.
Chris.
Re: Please help : Creating multiple IP records at one go
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-27-2020 01:54 PM
Try this example:
#!/usr/bin/env python3 import requests import urllib3 import sys import json urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning) wapi_base = "https://192.168.1.2/wapi/v2.8/" auth = ("admin", "infoblox") HEADERS = {'Content-type': 'application/json'} ses = requests.session() payload = [ { "method":"POST", "object":"fixedaddress", "data": { "name": "host001", "comment": "This is a comment for Host 001", "mac": "00:00:00:00:00:00", "ipv4addr": "10.102.109.1" } }, { "method":"POST", "object":"fixedaddress", "data": { "name": "host002", "comment": "This is a comment for Host 002", "mac": "00:00:00:00:00:00", "ipv4addr": "10.102.109.2" } }, { "method":"POST", "object":"fixedaddress", "data": { "name": "host003", "comment": "This is a comment for Host 003", "mac": "00:00:00:00:00:00", "ipv4addr": "10.102.109.3" } }] r = ses.post(wapi_base + 'request', json=payload, auth=auth, headers=HEADERS, verify=False) response = r.json() print (response)