- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
List all Zones and Lock Free IP
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-12-2015 08:54 PM
Re: List all Zones and Lock Free IP
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-13-2015 05:51 AM
#1 can be done through either downloading the named.conf from an appliance, which should be the same as what show config dns outputs from that same appliance, or querying for the zones through the API. I wrote a script to dump the equivalent of the db files and first download the named.conf and parse it to use the zones to do a zone transfer for the rest of the data. You may want to elaborate what you are doing in order to get a more precise answer.
#2 When we migrated from QIP to Infoblox a couple of years ago Infoblox added the functionality to address this issue of the QIP lock. They don't have a lock, but they allow you to add a host record on the next available IP, which is what we were actually using the lock for in our QIP script. Here is an example using curl ot do that, this requires v1.2.1 of wapi:
curl -s -k -u usernameassword -H "Content-Type: application/json" -d '{"name": "hostname.domain.com", "ipv4addrs":[{ "ipv4addr": "func:nextavailableip:10.0.0.0/24" }]}' -X POST https://gridmaster.domain.com/wapi/v1.2.1/record:host
Hi Craig and All,
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-13-2015 08:12 PM
Listing all zones
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-14-2015 06:11 AM
"before i query i would need list of all zones how can i get that" To get a list of all forward- and reverse-mapping zones in the default DNS view you can send an HTTPS GET request with the URL
https://gm.example.com/wapi/v2.0/zone_auth
Replace "gm.example.com" with the name of your grid master and "2.0" with the Web API version number for your version of NIOS (2.0 is for NIOS 7.0). This call will return a list of zone objects; each zone object contains (among other things) the field "fqdn", whose value is either the fully-qualified domain name for a forward mapping zone (e.g., "example.com") or the network address in CIDR format for a reverse mapping zone (e.g., "192.168.1.0/24").
If you need to retrieve the zones in a non-default DNS view then you can add an additional search criterion to the URL:
https://gm.example.com/wapi/v2.0/zone_auth?view=external
Once you have the list of zones you can retrieve records in each zone using the allrecords object, as you note;for example, an HTTPS GET request with the following URL will return all records in the zone "example.com" in the "external" DNS view:
https://gm.example.com/wapi/v2.0/allrecords?zone=example.com&view=external
However this just returns the name and type of the records; in actual practice you'll want to return additionalfields as well, for example
https://gm.lab.fhecker.com/wapi/v2.0/allrecords?zone=lab.fhecker.com&view=internal&_return_fields=na...
For record types other than A or AAAA (for which the "address" field holds the value) you'll need to unpack the"record" field to extract the record values.
"can't i directly perform GET/PUT/POST/DELETE REST api call over HTTPS without any curl etc installed." You can use any programming language you want to use. On these forums we typically use curl to show API examples because it's easy to try out the examples from the command line and doesn't require us to write Python or other code.
Thank you so much Frank this
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-18-2015 11:34 PM
However i have another
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-19-2015 02:04 AM
Returning list of network views and DNS views
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-19-2015 06:39 AM
My apologies, I gave you incorrect information. If you do a WAPI GET request for a URL like
https://gm.example.com/wapi/v2.0/zone_auth
it will in fact return a list of all zones, no matter what DNS view or network view they are in.
Recall that network views are at the highest level of the hierarchy: You can have multiple network views, each network view can contain multiple DNS views, and each DNS view (within a network view) can contain multiple zones. If you have only one network view and multiple DNS views within that network view then you can retrieve zones within a particular view by giving the DNS view name as part of the URL, for example:
https://gm.example.com/wapi/v2.0/zone_auth?view=external
for a DNS view named "external" and
https://gm.example.com/wapi/v2.0/zone_auth?view=default
for the default DNS view. (This assumes you haven't given the default DNS view a different name.)
If you have multiple network views then you have to specify the network view name as part of the URL as well. For example,
https://gm.example.com/wapi/v2.0/zone_auth?view=external.nv1
for zones in the DNS view "external" in the network view "nv1", or
https://gm.example.com/wapi/v2.0/zone_auth?view=external.nv1
for zones in the DNS view "external" in the default network view.
If you want a list of all the defined network views you can do a WAPI GET request with the following URL:
https://gm.example.com/wapi/v2.0/networkview
If you want a list of all the defined DNS views within a specified network view you can do a WAPI GET request with the following URL:
https://gm.example.com/wapi/v2.0/view?network_view=nv1
Thank you so much Frank. This
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-20-2015 07:02 AM
Use application/json header when doing WAPI POST operation
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-26-2015 01:22 PM
My apologies for the delay in responding. When you use a POST or PUT request to do a NIOS WAPI add or modify operation you need to include a Content-Type header specifying that the posted data is in JSON format. Recall that in the original example you linked to the curl command for the POST request had the option -H "Content-Type: application/json" to supply the necessary HTTP header. If you are programming in Python or Perl then you need to add some extra code to send the Content-Type header.
I'll start a separate thread and provide some curl and Python examples for adding, modifying, and deleting an A record.