- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
Host record A and PTR entities
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
11-19-2013 08:17 AM
Hello all.
I am creating and deleting Host records succesfully via REST /wapi/%apiVer%/record:host.
Should I expect to have A and PTR entities for each Host record via record:a and recordtr respectively? When I query the A and PTR I get nothing back.
Thx - Rock
HOST vs. A/PTR
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
11-19-2013 09:00 AM
No, you should expect to have a HOST object. This gets translated automatically at the protocol level into A and PTR records but you cannot access them as A and PTR records via the API.
Thanks Don! I have reset my
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
11-19-2013 10:28 AM
Thanks Don! I have reset my expectations
Create a Host with DNS Record Using the REST API
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
11-22-2013 12:25 AM
Hello,
I' m trying to create a host wit dns record:
https://.../wapi/v1.0/record:a -d '{ "name": "hostname.domainname.com", "ipv4addr":"192.168.200.11"}'
Is that the right WAPI call?
FYI: I' m using WAPI version 1.0
Thanks a lot
Create a Host with DNS Record Using the REST API
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
11-22-2013 04:51 AM
That call would create an A record. If you want to create a HOST record, you would make a call to "record:host" instead.
Hi,
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
11-26-2013 01:35 AM
Hi,
I tried it with record:host and this parameter
{"ipv4addrs":[{{"configure_for_dhcp": false, "ipv4addr": "123.123.123.123"}}], "name": "hostname.domanin.com", "configure_for_dns": true}
but i got the error
{ "Error": "AdmConDataError: None (IBDataConflictError: IB.Data.Conflict:Host records cannot be added to the zone domain.com while Microsoft servers are configured for the zone.)",
"code": "Client.Ibap.Data.Conflict",
"text": "Host records cannot be added to the zone domain.com while Microsoft servers are configured for the zone."
}
Have someone an idee, what the problem is?
Thanks a lot
Create Host records in MSFT "owned" zones
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
12-02-2013 02:24 PM
Host records can only be created for zones which are fully Infoblox managed. If the zone resides on a Microsoft Primary, only A/AAAA and PTR records can be created (in addition to other "regular" supported DNS records). To take advantage of Host records, you would need to migrate the zone "primary" to an Infoblox DNS server. You could then either continue to use MSFT DNS servers as secondaries or replace them all with Infoblox DNS servers and gain the advanced functionality offered as a fully integrated Infoblox zone.
Trying to create a new host by using wapi.
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
06-10-2014 05:16 PM
Hi,
I am tyring to create a host by using infoblox wapi,
Here is the code I was using.
import requests
>>> session = requests.Session()
>>> session.auth = ('root', 'a!')
>>> session.verify = False
>>> url = 'https://infoblox.example.com/wapi/v1.4/'
data = {'ipv4addrs':[{'ipv4addr':'10.7.191.225', 'configure_for_dhcp':'false'}], 'name':'aaa.host.com'}
>>> r= session.post(url+'record:host', data=data)
r.status_code
r.content
Getting errors as follows.
{ "Error": "AdmConProtoError: Arguments can not be repeated (ipv4addrs)", \n "code": "Client.Ibap.Proto", \n "text": "Arguments can not be repeated (ipv4addrs)"\n}'
I am curious about the errors I am getting.
Thanks
Using Python requests module to create host records
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
06-11-2014 09:19 AM
It looks as if you are using the Python requests module. I've done some work with that myself, and I think I know what your problem is.
First, when using the 'data' keyword argument to session.post you can't pass a dictionary directly; instead you have to convert it using json.dumps():
import json
r = session.post(url+'record:host', data=json.dumps(data))
That's the immediate cause of the 'Arguments can not be repeated' error you're seeing.
Next, you need to use a Boolean instead of a string when setting the values of parameters like 'configure_for_dhcp':
data = {'ipv4addrs': [{'ipv4addr': '10.7.191.225', 'configure_for_dhcp': False}], 'name': 'aaa.host.com'}
With these changes I was able to get your code to work on my system. The returned r.status_code should be 201 and the returned r.text should be a reference to the just-created host record.
Please let me know if this works for you as well.
Frank
It's working, and thanks a lot.
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
06-11-2014 11:03 AM
It's working perfectly, and appreciate again for the fast response.
python query
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
07-31-2015 12:20 PM
Using the RESTful API from Python
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
07-31-2015 02:19 PM
I haven't used the infoblox module for Python, and unfortunately I don't have time to try it out right now. However here is a sample Python program using the requests module (http://docs.python-requests.org/en/latest/
):
# Import the required Python modules. import requests import getpass import sys # Set parameters to access the NIOS WAPI. url = 'https://gm.example.com/wapi/v1.0/' id = 'api' # Userid with WAPI access valid_cert = False # True if GM uses a CA-issued certificate # Prompt for the WAPI user password. pw = getpass.getpass('Password for user ' + id + ': ') # Retrieve host records matching a search string. search_str = 'example' r = requests.get(url + 'record:host' + '?name~=' + search_str, auth=(id, pw), verify=valid_cert) if r.status_code != requests.codes.ok: print r.text exit_msg = 'Error {} finding host(s): {}' sys.exit(exit_msg.format(r.status_code, r.reason)) results = r.json() # Print the raw output for each host found. for result in results: print result
Thanks! That works great!
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
08-03-2015 10:08 AM
Error - cannot register A record in DNS infoblox
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
08-16-2015 08:23 PM
Re: Using Python requests module to create host records
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
11-16-2017 03:13 PM
Hi FHecker,
I am new to coding and learning WAPI with python. Trying with python requests module to create HOST record. Which I am abel to but when I try to create the record with 'ttl' value also set, I getting error back as 'BAD REQUEST'. I tried multiple options but no success. Can you help?
Options I tried:
hostdata = {'ipv4addrs':[{'ipv4addr': ipaddress},{'ttl':'30'}],'name': hostname}
addHostRec = session.post(hostaddurl, data=json.dumps(hostdata))
-------
hostdata = {'ipv4addrs':[{'ipv4addr': ipaddress,'ttl':'30'}],'name': hostname}
addHostRec = session.post(hostaddurl, data=json.dumps(hostdata))
-------
hostdata = {'ipv4addrs':[{'ipv4addr': ipaddress]},'name': hostname,'ttl':'30'}
addHostRec = session.post(hostaddurl, data=json.dumps(hostdata))
Re: Using Python requests module to create host records
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
11-16-2017 05:37 PM
Hi,
The issue may be that you are providing the TTL value as a string. An integer is expected there.
The below sample worked for me.
Sample script:
#!/usr/bin/python
import requests, json, sys
from requests.auth import HTTPBasicAuth
from requests.packages.urllib3.exceptions import InsecureRequestWarning
requests.packages.urllib3.disable_warnings(InsecureRequestWarning)
hostname = sys.argv[1]
ip = sys.argv[2]
labgridip = '10.192.33.12'
labgriduser = 'admin'
labgridpassword = 'infoblox'
def createhost(n, i ):
data = json.dumps({"ipv4addrs":[{"ipv4addr": i}],"name": hostname,"view": "default", "ttl": 30})
response = requests.post("https://"+labgridip+"/wapi/v2.6/record:host", data, auth=(labgriduser, labgridpassword), verify=False)
print response.text
createhost(hostname, ip)