Skip to main content

Creating and testing a WHOIS API request with Postman

Introduction

An application programming interface (API) allows software components to communicate. Developers test APIs to verify they operate reliably and securely. This guide details one specific use case: using the Postman platform to test the WHOIS API with the domain facebook.com to retrieve its registration details.

Access the Postman API platform

An account is required to access Postman, an online platform for developing and testing APIs. Navigate to the Postman website, and click on the Sign Up for Free button. Create an account using an email address, Google sign-in, or single sign-on.

Postman sign up page

Postman can be accessed by installing the desktop agent for Mac, Windows, or Linux or via a modern web browser. This document will cover the process of using Postman in the web browser. However, the process of API testing showcased is identical to that of using the desktop agent.

Acquire the WHOIS API key

An account is required to generate and access a unique WhoisXMLAPI key. Navigate to the WhoisXMLAPI website, and click on the Sign Up button. Create an account by using an email address.

WhoisXMLAPI sign up page

After creating an account, navigate to the Account button in the top right corner and select My Products. You will be directed to the My Products page with a unique API key. Keep the API key accessible for later steps.

WhoisXMLAPI My Products page with API key

Create a workspace in Postman

After logging into Postman in a web browser, navigate to the header > Workspaces > Create Workspace.

Create Workspace menu in Postman

Enter the requested information and permissions settings, then click the Create Workspace button. Navigate to the header > Workspaces, and select the recently created workspace.

Postman workspace view

Test the API

  1. In the Collections tab on the left side of the page, click + to create a new collection. Edit the name, description, and other settings as desired.

    Creating a new collection in Postman

  2. Hover your cursor over New Collection, then click on the three-dot button, followed by Add request. Name the request as desired.

    Adding a new request to a collection in Postman

  3. Navigate to the recently created request and enter the following API endpoint in the Enter request URL field box:

    text
    https://www.whoisxmlapi.com/whoisserver/WhoisService?apiKey=API_KEY&domainName=google.com

    Entering the WHOIS API endpoint URL in Postman

  4. Ensure the dropdown box left of the Enter request URL field box is set to GET. The GET method of API testing retrieves information from a given server using a given URL, without affecting the data. The WHOIS API also supports the POST method of requests, which sends data to a server to create or update a resource.

  5. The apiKey and domainName parameters are required. Under Query Params of the Params tab, enter the previously acquired WHOISXML API key in the value field of the apiKey key. The vaule of the domainName key should be the desired testing domain. In this case, the domain facebook.com is used.

    Setting Query Params for apiKey and domainName in Postman

  6. Optional input parameters can also be entered. Let’s say the desired output response format is JSON. You can do so by adding the outputFormat key with the value set to JSON. Click here for a list of WHOIS API’s other optional input parameters for making API requests.

    Adding optional outputFormat parameter in Postman

  7. Navigate to the Authorization tab to add authorization tokens or credentials per the server’s requirements. For this use case, select Inherit auth from parent under the authorization type dropdown menu since the API key has already been entered in the previous step.

    Authorization tab in Postman set to Inherit auth from parent

  8. Click the blue Send button to execute the API request. The response data sent from the server will be visible in the response pane.

    Postman response pane showing successful API response

  9. Success!

What just happened?

Postman has sent a GET request to the WHOIS API. The server processed the request and returned the data in the response pane. A lack of error messages in the response code indicates a successful test.