Skip to content
Golang API client for NS1
Branch: v2
Clone or download
Latest commit a57b2a1 Dec 11, 2018
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
git-hooks
rest catch record not found in update Dec 11, 2018
script More go vet fixes and adds golint back in test script. Sep 15, 2016
.gitignore Initial working client with 1 method Jul 22, 2015
.travis.yml
LICENSE.txt
README.md README sample code: really give up without NS1_APIKEY May 2, 2017
doc.go

README.md

Build Status GoDoc

NS1 Golang SDK

The golang client for the NS1 API: https://ns1.com/api/

Installing

$ go get gopkg.in/ns1/ns1-go.v2

Examples

See more

package main

import (
	"fmt"
	"log"
	"net/http"
	"os"
	"time"

	api "gopkg.in/ns1/ns1-go.v2/rest"
)

func main() {
	k := os.Getenv("NS1_APIKEY")
	if k == "" {
		fmt.Println("NS1_APIKEY environment variable is not set, giving up")
		os.Exit(1)
	}

	httpClient := &http.Client{Timeout: time.Second * 10}
	client := api.NewClient(httpClient, api.SetAPIKey(k))

	zones, _, err := client.Zones.List()
	if err != nil {
		log.Fatal(err)
	}

	for _, z := range zones {
		fmt.Println(z.Zone)
	}

}

Contributing

Contributions, ideas and criticisms are all welcome.

LICENSE

Apache2 - see the included LICENSE file for more information

You can’t perform that action at this time.