pricing background

Go API Integration

api

live

package main

import (
	"fmt"
	"net/http"
	"strings"
	"io/ioutil"
)

func main() {
	var payload *strings.Reader = nil
	req, _ := http.NewRequest("GET", "https://api.whoisfreaks.com/v1.0/whois?apiKey=API_KEY&whois=live&domainName=google.com", payload)
	client := &http.Client{}
	resp, _ := client.Do(req)
	defer resp.Body.Close()
	body, _ := ioutil.ReadAll(resp.Body)
	fmt.Println(string(body))
}

Historical

package main

import (
	"fmt"
	"net/http"
	"strings"
	"io/ioutil"
)

func main() {
	var payload *strings.Reader = nil
	req, _ := http.NewRequest("GET", "https://api.whoisfreaks.com/v1.0/whois?apiKey=API_KEY&whois=historical&domainName=google.com", payload)
	client := &http.Client{}
	resp, _ := client.Do(req)
	defer resp.Body.Close()
	body, _ := ioutil.ReadAll(resp.Body)
	fmt.Println(string(body))
}

Reverse

package main

import (
	"fmt"
	"net/http"
	"strings"
	"io/ioutil"
)

func main() {
	var payload *strings.Reader = nil
	req, _ := http.NewRequest("GET", "https://api.whoisfreaks.com/v1.0/whois?apiKey=API_KEY&whois=reverse&keyword=youtube", payload)
	client := &http.Client{}
	resp, _ := client.Do(req)
	defer resp.Body.Close()
	body, _ := ioutil.ReadAll(resp.Body)
	fmt.Println(string(body))
}

Bulk Whois

package main

import (
	"fmt"
	"net/http"
	"strings"
	"io/ioutil"
)

func main() {
	payload := strings.NewReader("{"domainNames": ["amazon.ch","google.com","whoisfreaks.com","nic.dev","news.si"]}")
	req, _ := http.NewRequest("GET", "https://api.whoisfreaks.com/v1.0/bulkwhois?apiKey=API_KEY", payload)
	req.Header.Set("Content-Type", "application/json")
	client := &http.Client{}
	resp, _ := client.Do(req)
	defer resp.Body.Close()
	body, _ := ioutil.ReadAll(resp.Body)
	fmt.Println(string(body))
}