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/v2.0/dns/live?apiKey=API_KEY&domainName=whoisfreaks.com&ipAddress=8.8.8.8&type=all", 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/v2.0/dns/historical?apiKey=API_KEY&domainName=whoisfreaks.com&type=all&page=1", 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/v2.1/dns/reverse?apiKey=API_KEY&format=json&value=8.8.8.8&type=a", payload)
	client := &http.Client{}
	resp, _ := client.Do(req)
	defer resp.Body.Close()
	body, _ := ioutil.ReadAll(resp.Body)
	fmt.Println(string(body))
}

Bulk DNS

package main

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

func main() {
	payload := strings.NewReader("{"domainNames": ["whoisfreaks.com","jfreaks.com"],"ipAddresses": ["1.1.1.1","8.8.8.8"]}")
	req, _ := http.NewRequest("GET", "https://api.whoisfreaks.com/v2.0/dns/bulk/live?apiKey=API_KEY&type=all&format=json", 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))
}