https://github.com/whois-api-llc/website-contacts-go
Website Contacts API client library for Go
https://github.com/whois-api-llc/website-contacts-go
contacts go golang website website-contacts whoisxmlapi
Last synced: about 1 year ago
JSON representation
Website Contacts API client library for Go
- Host: GitHub
- URL: https://github.com/whois-api-llc/website-contacts-go
- Owner: whois-api-llc
- License: mit
- Created: 2022-07-14T08:33:50.000Z (almost 4 years ago)
- Default Branch: master
- Last Pushed: 2022-07-14T09:40:58.000Z (almost 4 years ago)
- Last Synced: 2025-01-25T21:27:58.768Z (over 1 year ago)
- Topics: contacts, go, golang, website, website-contacts, whoisxmlapi
- Language: Go
- Homepage: https://website-contacts.whoisxmlapi.com/api
- Size: 8.79 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://opensource.org/licenses/MIT)
[](https://pkg.go.dev/github.com/whois-api-llc/website-contacts-go)
[](https://github.com/whois-api-llc/website-contacts-go/actions/)
# Overview
The client library for
[Website Contacts API](https://website-contacts.whoisxmlapi.com)
in Go language.
The minimum go version is 1.17.
# Installation
The library is distributed as a Go module
```bash
go get github.com/whois-api-llc/website-contacts-go
```
# Examples
Full API documentation available [here](https://website-contacts.whoisxmlapi.com/api/documentation/making-requests)
You can find all examples in `example` directory.
## Create a new client
To start making requests you need the API Key.
You can find it on your profile page on [whoisxmlapi.com](https://whoisxmlapi.com/).
Using the API Key you can create Client.
Most users will be fine with `NewBasicClient` function.
```go
client := websitecontacts.NewBasicClient(apiKey)
```
If you want to set custom `http.Client` to use proxy then you can use `NewClient` function.
```go
transport := &http.Transport{Proxy: http.ProxyURL(proxyUrl)}
client := websitecontacts.NewClient(apiKey, simplegeoip.ClientParams{
HTTPClient: &http.Client{
Transport: transport,
Timeout: 20 * time.Second,
},
})
```
## Make basic requests
Website Contacts API lets you get well-structured domain owner contact information, including company name and key contacts with direct-dial phone numbers, email addresses, and social media links.
```go
// Make request to get parsed Website Contacts API response for the domain name
wContactsResp, resp, err := client.Get(ctx, "whoisxmlapi.com")
if err != nil {
log.Fatal(err)
}
log.Println(wContactsResp.DomainName)
log.Println(wContactsResp.Emails)
// Make request to get raw Website Contacts API data
resp, err := client.WContactsService.GetRaw(context.Background(), "whoisxmlapi.com")
if err != nil {
log.Fatal(err)
}
log.Println(string(resp.Body))
```