How to lookup domain WHOIS in Javascript
1 min readMar 11, 2020
In this article we will be showing step by step how to gather WHOIS information for a domain using Javascript. Total time required, about 5 minutes.
Import our API client first using this script tag, which you can add into your HTML file.
<script src="https://cdn.cloudmersive.com/jsclient/cloudmersive-validate-client.js"></script>
When that’s done with, call this function here:
var CloudmersiveValidateApiClient = require('cloudmersive-validate-api-client');var defaultClient = CloudmersiveValidateApiClient.ApiClient.instance;// Configure API key authorization: Apikeyvar Apikey = defaultClient.authentications['Apikey'];Apikey.apiKey = 'YOUR API KEY';// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)//Apikey.apiKeyPrefix = 'Token';var apiInstance = new CloudmersiveValidateApiClient.DomainApi();var domain = "domain_example"; // String | Domain name to check, for example \"cloudmersive.com\". The input is a string so be sure to enclose it in double-quotes.var callback = function(error, data, response) {if (error) {console.error(error);} else {console.log('API called successfully. Returned data: ' + data);}};apiInstance.domainPost(domain, callback);
Enter in your domain and shortly after the API will send back the WHOIS information. It’s really that easy. Want more useful functions like this? We have a ton; everything from swapping document formats to cropping images and converting photos to text.