- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Printer Friendly Page
Single API call to see if server/host/dns name is in use ??
11-16-2021 12:58 AM
Is there a single API call to see if a server/host/dns name is in use?
Essentially, when needing to provision a new server, I want to do a DNS check (of sorts) to see if a host with that name already exists, but I noticed that host-record, host-alias, cname (and possibly others) etc. are all seperate calls and objects.
For instance, I could have a host-alias called "myserver.mydomain.org", but if I were to do a host check against this server, it would return nothing. Similarly I could have a cname called "myserver.mydomain.org" and do a host and/or alias check, and still get nothing back because cnames are yet again different.
I'm hoping there is a single API call I can make that would return a match irregardless of the type, but so far I haven't been able to find it or overlooked it.
Re: Single API call to see if server/host/dns name is in use ??
11-16-2021 04:58 AM
I'm not aware of anytthign that will do exactly what you want but this seems to work pretty well. It requires the FQDN to be split into the zone and the hostname.
It will return a list of matching records. I found that for host aliases, and for DTC LBDNs it says the record type is "UNSUPPORTED". Otherwise it will also return the record type. An empty response would indicate the record does not exist.
curl -k -u admin:infoblox -X GET 'https://192.168.1.2/wapi/v2.11/allrecords' -d 'name=myhostname&zone=example.org&view=Internal%20DNS&_max_results=2'