Module whohoststhis
ballerinax/whohoststhis Ballerina library
Overview
The Who Hosts This API v0.0.1 connector(https://www.who-hosts-this.com/Documentation) OpenAPI specification. The Who Hosts This API provides services to get discover the hosting provider for any web site.
Key Features
- Programmatic access to create and manage resources via REST API
- Manage user accounts and profiles
- Secure authentication with API key or OAuth support
Prerequisites
Before using this connector in your Ballerina application, complete the following:
- Create an Who Hosts This Account.
- Obtain tokens - Follow this link.
Quickstart
To use the Who Hosts This connector in your Ballerina application, update the .bal file as follows:
Step 1: Import connector
First, import the ballerinax/whohoststhis module into the Ballerina project.
import ballerinax/whohoststhis;
Step 2: Create a new connector instance
whohoststhis:ApiKeysConfig apiKeyConfig = { key: "<API_KEY>" }; whohoststhis:Client baseClient = check new Client(apiKeyConfig, serviceUrl = "https://www.who-hosts-this.com/APIEndpoint");
Step 3: Invoke connector operation
-
Now you can use the operations available within the connector. Note that they are in the form of remote operations.
Following is an example to discover the hosting provider for a web site.
public function main() returns error? { json listHostingProvider = check baseClient->discoverHostingProvider("www.wso2.com"); log:printInfo(listHostingProvider.toString()); } -
Use
bal runcommand to compile and run the Ballerina program.