- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
API call to record return empty list
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-11-2024 11:44 PM
Hi all,
I'm want to do a (simple?) GET request that resolves hostname to IPv4 address. I cannot do this via DNS, but I do have access to infoblox API. The problem is, it sometimes returnes an empty list:
GET wapi/v2.12.3/record:host?name~=somehostname
RESPONSE:
200 OK
[]
If I log in to Infoblox GUI and search on DNS Name I get several hits for the same hostname (A, PTR, TXT etc). There definately is a host record in infoblox for that hostname. I have tried various variants of record calls, but they all show the same behaviour. It does not seem to matter if I use ~=, = or := nor if I match the full fqdn exactly.
Do I use the wrong endpoint? Is there an eqvivalent of the seach function in the GUI for DNS Name?
Cheers,
Re: API call to record return empty list
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-12-2024 04:30 AM
Your search will only return host records that match, it won't return any other types of records.
You could potentially do an allrecords search but that requires knowing the zone to search in.
GET /wapi/v2.12/allrecords?name~=something&zone=example.org
You could also do an actual DNS dig query:
POST 'https://gm.example.org/wapi/v2.12/grid?_function=query_fqdn_on_member&member=gm.example.org&fqdn=www.infoblox.com'
Re: API call to record return empty list
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-12-2024 12:34 PM
Thanks for the reply. Explain it to me like I'm five. I get the same result if I do:
GET wapi/v2.12.3/record:a?name=somehost.domain.com
... and it obviously have an A record since I can see it in the GUI?
Re: API call to record return empty list
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-12-2024 12:46 PM
Take a look in the GUI, there may be an A record and also a HOST record with the same name & IP address.
Re: API call to record return empty list
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-12-2024 12:57 PM
Don't think so, but I'm better at writing code than managing Infoblox.
Re: API call to record return empty list
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-15-2024 11:54 AM
GIven that a search in GUI for A-record return a result (more specifically two in this case), should not an API call to record:a return the same result?
Re: API call to record return empty list
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-16-2024 05:32 AM
Yes I agree, unfortunately it's hard to know what's going on without your actual data and code and such.
Note that only one A record is returned in the GUI, however it's matched for multiple reasons so it's displayed multiple times.