Class WhoisHttpAction

java.lang.Object
google.registry.whois.WhoisHttpAction
All Implemented Interfaces:
Runnable

public final class WhoisHttpAction extends Object implements Runnable
Human-Friendly HTTP WHOIS API

This API uses easy to understand paths rather than WhoisAction which requires a POST request containing a WHOIS command. Because the typical WHOIS command is along the lines of "domain google.lol" or the equivalent "google.lol, this action is just going to replace the slashes with spaces and let WhoisReader figure out what to do.

This action accepts requests from any origin.

You can send AJAX requests to our WHOIS API from your very own website using the following embed code:


 <input id="query-input" placeholder="Domain, Nameserver, IP, etc." autofocus>
 <button id="search-button">Lookup</button>
 <pre id="whois-results"></pre>
 <script>
  (function() {
    var WHOIS_API_URL = 'https://domain-registry-alpha.appspot.com/whois/';
    function OnKeyPressQueryInput(ev) {
      if (typeof ev == 'undefined' && window.event) {
        ev = window.event;
      }
      if (ev.keyCode == 13) {
        document.getElementById('search-button').click();
      }
    }
    function OnClickSearchButton() {
      var query = document.getElementById('query-input').value;
      var req = new XMLHttpRequest();
      req.onreadystatechange = function() {
        if (req.readyState == 4) {
          var results = document.getElementById('whois-results');
          results.textContent = req.responseText;
        }
      };
      req.open('GET', WHOIS_API_URL + escape(query), true);
      req.send();
    }
    document.getElementById('search-button').onclick = OnClickSearchButton;
    document.getElementById('query-input').onkeypress = OnKeyPressQueryInput;
  })();
 </script>
 
See Also: