Reply

Get Records Specific to View

New Member
Posts: 6
5904     0

I have been attempting to GET host records specific to a view given a record name. For example I build a GET request for the domain my.zone.com and I get 2 host objects from 2 different views (internal and external). 

curl -k -u user:pass -H "Content-Type: application/json" https://10.0.0.1/wapi/v1.4.2/record:host?name=my.zone.com

It appears there is a way to limit a search to a view, but my attempts have not worked. Below is what I believed was the solution, but it still returns both views:

curl -k -u  user:pass -H "Content-Type: application/json" https://10.0.0.1/wapi/v1.4.2/record:host?name=my.zone.com&view=internal

Any insight is much appreciated!

 

 

Returning records for a specific view

Adviser
Posts: 33
5905     0

It is indeed possible to limit returned host records to a specific DNS view. Here's how I did it just now on my own lab system (it's running NIOS 7.1, but I specified WAPI version 1.4.1 instead of 2.1 to match your example):

curl --tlsv1 --insecure --user 'admin:infoblox' 'https://gm.example.com/wapi/v1.4.1/record:host?name=foo.example.com&view=internal'

I have two views, "internal" (the default) and "external". If I leave the view parameter off it returns two host records, if I specify the view as shown above I get only one host record returned.

Theere are two substantive differences between my example and yours. The first difference is that I did not include the -H option for the Content-Type header. That header is required only for POST and PUT requests. I tried adding it anyway and it did not make a difference.

The second difference is what I think is causing your problem: You did not put quotes around the WAPI URL. Because of that, if you are on a Unix/Linux/OS X system then the command shell will interpret the ampersand (&) in the URL as the signal to run the command in the background. The "view=internal" part (and anything else after the ampersand) will be ignored as part of the WAPI command--that's why you get multiple records returned. (Instead "view=internal" will be interpreted as a shell command that sets the value of the shell variable "view" to the value "internal". This doesn't produce any output, so the WAPI command looks like it worked OK.)

So try putting single quotes around the https://10.0.0.1/... URL and see if that works. (You should use single quotes instead of double quotes because on Unix-like systems the shell will still look inside double quotes and interpolate variable values.

Showing results for 
Search instead for 
Did you mean: 

Recommended for You