Single API call to see if server/host/dns name is in use !?

Posts: 14
308     0



Is there a single API call to see if a server/host/dns name is in use?


Essentially, when needing to provision a new server, I want to do a DNS check (of sorts) to see if a host with that name already exists, but I noticed that host-record, host-alias, cname (and possibly others) etc. are all seperate calls and objects.


For instance, I could have a host-alias called "", but if I were to do a host check against this server, it would return nothing. Similarly I could have a cname called "" and do a host and/or alias check, and still get nothing back because cnames are yet again different.


I'm hoping there is a single API call I can make that would return a match irregardless of the type, but so far I haven't been able to find it or overlooked it.



Re: Single API call to see if server/host/dns name is in use !?

[ Edited ]
Posts: 162
309     0

Hello RdeVries_2,     


I think you're looking for something similar to a global search. Here's a sample call for the use-case :


# Find matching patterns from the Grid

import requests
import urllib3
import json
from os import system, name

def clear():
    if name == 'nt':
        _ = system('cls')
        _ = system('clear')


gm_ip = input("\n\nEnter Grid Mater's IP :")
gm_user = input("\nEnter user name :")
gm_password = input("\nEnter password :")

fqdn_to_be_searched = input("\nEnter the FQDN to be searched :")
urL = 'https://' + gm_ip + '/wapi/v2.9/search?search_string=' + fqdn_to_be_searched
response = requests.get(urL, auth=(gm_user, gm_password), verify=False)
mid_value = response.content
response_native = json.loads(mid_value)
format_output_data = json.dumps(response_native, indent=1)

if format_output_data == "[]":
    print("No matching patterns found in search")
    print("Found at least one matching entry..\n\n")

Hope this is helpful!


Best regards,

Mohammed Alman

Re: Single API call to see if server/host/dns name is in use !?

Posts: 14
309     0

Thanks Mohammed. I also found the "allrecords" object which I think can help. This is quite a vast API .. it's like a treasure hunt Smiley Happy


Anyway, thanks again for all your help. Much appreciated!



Showing results for 
Search instead for 
Did you mean: 

Recommended for You