Making a Whois Service in OutSystems
I’m building a site in OutSystems to register domains. The first step is to check if the domain is available. And if not, when will it be. For that I need to do a WHOIS.
There are several APIs online to check the WHOIS of a domain (current owner and expiration date among other useful informations).
My first try was with Mashape’s JsonWhoisAPI.com, but when it started having issues, I went looking for alternatives.
The best I found was Jsonwhois.IO and the same team is also giving us WebCargo.IO with an almost identical structure. I also did it for JsonWhois.COM because it has a bigger number of free calls and it may be enough for some users. Curiosity: this one is the only site that requires the access token in the header of the request, all others take it as a parameter in the URL.
In case you decide to expand this, one service I didn’t like was Hexillion.com. Fewer services, fewer free tries and too eager to get credit card data. Also, it didn’t work perfectly in OutSystems.
Three was enough so I went along with it.
How was this made
First I made the service calls. By using the Consume REST API and adding the URL with parameters, I could get an example of each service and define the needed structures.
Based in the fields of the similar services, I designed a common structure for all of them to use and return a single set of data.
By assigning everything to that common structure, the result is a set of very different services that look the same.
The initial idea was to get only the Whois information, but all that other data available with so little work, made me chnge my mind and expand this project to all the other available services.
Because the structures are in a separate eSpace, anyone who only needs one of these providers can simple delete the other eSpaces and keep WHOIS_CS (Core module with the structures) because JSONWHOISCOM_IS, JSONWHOISIO_IS and WEBCARGO_IS can work fine without the rest.
Finally, to test for myself and show to everyone how this works, I made WHOIS_Example where anyone can simply try the services with their own key.