Reply

Returning a list of Aliases using the record:alias API request

Member
Posts: 2
190     0

Hi Experts, 

Could anyone out there advise how I can use the record:alias API request to obtain a list of host aliases? The Infoblox grid viewer allows you to request a list of all Aliases by use of a filter of: Type = Host Alias. I need to replicate this via an API request. On the face of it a 'request:alias' seems to be what I want, but when I try this I get no data back at all. I've tried adding adding a search criteria e.g. zone=abc.co.nz but still no joy. 

I realise that I can get a list of Aliases via a 'request:host'  and specifing alias as an extra returned field in the request, but given that I also want additional alias fields eg comments etc. this seems a long way around. 

I can get the hosts, cname, a records API requests to return me the results I need, I just can't seem to fathom how the alias API request is meant to work, or am I missing something?

Any assitance or an example woud be greatly appreciated.

Re: Returning a list of Aliases using the record:alias API request

Adviser
Posts: 50
191     0

First let's clarify the difference between a CNAME record (colloquially known as a DNS alias), a Host record that has Aliases attached to it, and an ALIAS record.

 

The CNAME record is the most straightforward; a standard DNS record type associated with the "record:cname" object type in WAPI.

 

In the GUI for a Host record, there is an "Aliases" tab. This is an Infoblox specific convenience feature that ultimately creates CNAME records under the hood, but keeps them associated with the parent Host record so you don't have to maintain them separately. There is no individual "record:blah" object type for these. They only exist as a field on the "record:host" object.

 

The ALIAS record is a relatively new *virtual* record type to address the DNS spec limitation that CNAMEs can't be associated with apex domains. This is what the "record:alias" is referencing. See also here: https://docs.infoblox.com/display/nios85/Managing+Resource+Records#ManagingResourceRecords-bookmark1...

 

Based on your question, I'm guessing your queries that reference "record:alias" are not finding anything because you haven't actually created any ALIAS records. What it sounds like you have are the aliases associated with host objects. But unfortunately, there's no way to query *just* those because the "aliases" attribute on "record:host" doesn't allow for any filter criteria. So your only solution is to search for all host objects and filter them client side.

 

The other option is to convert all of those host aliases to individual CNAME records which are then queryable directly. But you lose the convenience of having them directly associated with your hosts.

Re: Returning a list of Aliases using the record:alias API request

Member
Posts: 2
191     0

Hi,

Thankyou so much you have clarified the situation perfectly. 

And, yes I was hoping to be able to able to use the record:alias to pull a list of aliases for hosts. As you have pointed out this doesn't work like this. In the mean time I did exactly what you sugested and pulled the aliases as part of the host processing and extracted them 'client' side. Nice to know that my solution aligned with your suggestion and I haven't wasted my time. 

 

I am most grateful for you taking the time the to explain. For someone who doesn't have an in depth knowledge of all things DNS and just needs to extract the infomation this has helped me a lot!

 

Best Regards 

Re: Returning a list of Aliases using the record:alias API request

Techie
Posts: 5
191     0

HIKiwipete

 good to see this post im alos looking for the same. but im not getting the result of aliases and cname associate to a host

im checking with host:record name~

 lookup('nios', 'record:host', filter={'name~': '

can you pls post your steps how you achieved it.

Re: Returning a list of Aliases using the record:alias API request

Adviser
Posts: 50
191     0

I don't recognize the lookup function you posted. But generally, you need to request the specific return fields you want to see in the response. When you're doing a raw REST call, it would be using a querystring argument like "_return_fields=aliases". So perhaps your lookup function as an optional argument for return fields?

Showing results for 
Search instead for 
Did you mean: 

Recommended for You