Learn How We Can Help You Keep Teleworkers Protected During the COVID-19 Crisis

API & Integration

Reply
Highlighted

How to search with WAPI for hostnames(including canonnical names in cname) regardless the recordtype

[ Edited ]
Techie
Posts: 2
4538     2

Hi,

I'm looking for a solution via the WAPI for the following.
We receive deletion request where there requester only defines the hostname.

With that hostname I need to find all DNS records related to that host, including:
- A records
- HOST records
- PTR records
- CNAMEs having the hostname in the CNAME
- CNAMEs pointing to the given hostname (so the cannonical name in Infoblox), regardless the CNAME-name.

As far as I know the WAPI search function requires the recordtype to be defined, so for example:
curl -k1 -s -u <user> -X GET https://<infobloxgui>/wapi/<apiversion>/record:a?name~=<hostname> for an A record or:
curl -k1 -s -u <user> -X GET https://<infobloxgui>/wapi/<apiversion>/record:cname?name~=<hostname> for a cname.

My questions are:
1) Is it possibile to search with the WAPI  the database for a hostname regardless the recordtype so it will search in any record type? (so one query for all in stead of separate queries for each recordtype)?
2) How to search with the WAPI for a CNAME by Canonnical Name.
    So for example: Lets say a CNAME named 'cname1' points to 'destination1'
                              How to search for 'destination1' using the WAPI so it will find 'cname1'?

Thanks in advance for your help/

Highlighted

Re: How to search with WAPI for hostnames(including canonnical names in cname) regardless the record

Adviser
Posts: 136
4539     2

Hi,

 

1. You can use "allrecords" to retreive all records for a zone. 

2. Use "canonical"

 

BR,

Vadim

Highlighted

Re: How to search with WAPI for hostnames(including canonnical names in cname) regardless the record

Techie
Posts: 12
4539     2

 

Is there a to expand the search to include all zones in a view?

Highlighted

Re: How to search with WAPI for hostnames(including canonnical names in cname) regardless the record

Adviser
Posts: 136
4539     2

@ton10291 wrote:

 

Is there a to expand the search to include all zones in a view?


By default it search in all zones but if you define name it includes a zone. If you a lloking just for a specific hostname w/o a zone, you can use regex e.g.

/wapi/v2.6/record:a?name~=.*tme.*
Highlighted

Re: How to search with WAPI for hostnames(including canonnical names in cname) regardless the record

Authority
Posts: 42
4539     2

A more helpful response might be:

 

https://<servername>/wapi/<version>/record:cname?canonical=<fqdn>
Showing results for 
Search instead for 
Do you mean 

Recommended for You

Demo: Infoblox IPAM plug-in integration with OpenStack Newton