Reply
Highlighted
Accepted Solution

API Search Returns only 2 Appearances of a Host

[ Edited ]
Toty21
Techie
Posts: 6
3230     0

Hello all,

 

I was hoping to get a little assistance with a small issue I am having. While doing a search for a hostname, the API only returns 2 instances found even when there are 3 or more instances/hosts with the same name in IPAM. I am attempting the automate the  retrieval of assigned IP addresses for a specific hostname, but I am not sure why it only returns 2 max. The code is below:

 

LHOSTNAME = "hmwanor1dybh01800r01"
searchHostURL = https://mynetwork.com/wapi/v2.5/record:host?name~=" & LHOSTNAME

 

 

WAPI.open "GET", searchHostURL, false, userName, password
WAPI.setRequestHeader "Content-Type", "application/json; charset=UTF-8"
WAPI.setRequestHeader "CharSet", "charset=UTF-8"
WAPI.setRequestHeader "Accept", "application/json"
WAPI.send ""
MsgBox WAPI.responseText

 

Thanks is advanced for any help assistance with this.

 

Toty21

Re: API Search Returns only 2 Appearances of a Host

Moderator BRampling
Moderator
Posts: 69
3231     0

I just tested this:

 

curl -k1 -u admin:xxx -H "Content-Type: application/json" -X GET https://10.60.27.4/wapi/v2.5/record:host?name~=a1

 

I received 4 objects in the response, as expected. I'm not sure why your query wouldn't be returning all matching records, the syntax is correct. The default setting for _max_results is 1000.

Re: API Search Returns only 2 Appearances of a Host

Toty21
Techie
Posts: 6
3231     0

BRampling, thanks for your quick response. while doing some more troubleshooting I realized that the actual display box was concatenating the returned string. I had to display the results with a different type of box. 

Thanks again.

Showing results for 
Search instead for 
Do you mean 

Recommended for You