This is a Go client for updown.io. Updown lets you monitor websites and online services for an affordable price.
Once you have a working Go installation locally, you can grab this package with the following command:
go get github.com/antoineaugusti/updown
Head over to the Go documentation to see available methods and models and to https://updown.io/api for the Updown API.
The client will be required to perform all actions against the API.
package main
import (
"github.com/antoineaugusti/updown"
)
func main() {
// Your API key can be retrieved at https://updown.io/settings/edit
// You can give a custom HTTP client
client := updown.NewClient("your-api-key", nil)
}
result, HTTPResponse, err := client.Check.List()
name := "Google"
token, err := client.Check.TokenForAlias(name)
This method returns results from a memory cache by default if it's available. The first time, a request against the API will be performed.
token := "foo"
result, HTTPResponse, err := client.Check.Get(token)
token, page := "foo", 1 // 100 results per page
result, HTTPResponse, err := client.Downtime.List(token, page)
// See the struct for additional parameters
item := updown.CheckItem{URL: "https://google.fr"}
result, HTTPResponse, err := client.Check.Add(item)
token := "foo"
// See the struct for additional parameters
updated := updown.CheckItem{URL: "https://google.com"}
result, HTTPResponse, err := client.Check.Update(token, updated)
token := "foo"
result, HTTPResponse, err := client.Check.Remove(token)
token, group := "foo", "host"
from, to := "2016-04-01 00:00:00 +0200", "2016-04-15 00:00:00 +0200"
result, HTTPResponse, err := client.Metric.List(token, group, from, to)