A Go client library for Uptime.com
The List() methods on all endpoints now return *ListResult[Item] instead of []Item to expose pagination metadata (total count) from API responses.
Migration:
// Before (v2.5.x and earlier)
checks, err := api.Checks().List(ctx, upapi.CheckListOptions{})
if err != nil {
return err
}
for _, check := range checks {
fmt.Println(check.Name)
}
// After (v2.6.0+)
result, err := api.Checks().List(ctx, upapi.CheckListOptions{})
if err != nil {
return err
}
for _, check := range result.Items {
fmt.Println(check.Name)
}
// Access total count for pagination
fmt.Printf("Showing %d of %d checks\n", len(result.Items), result.TotalCount)The ContactGroups field type has changed from []string to *[]string across all check types to properly support PATCH requests.
Migration:
// Before (v2.4.x and earlier)
check := upapi.CheckHTTP{
ContactGroups: []string{"Default"},
}
// After (v2.5.0+)
check := upapi.CheckHTTP{
ContactGroups: &[]string{"Default"},
}
// To explicitly set empty contact groups (clears the field)
check := upapi.CheckHTTP{
ContactGroups: &[]string{},
}
// To omit the field (useful for PATCH - won't update the field)
check := upapi.CheckHTTP{
ContactGroups: nil,
}- Checks
- Dashboards
- Tags
- Outages
- Integrations
- Probe servers
- Contact groups (partial)
Downdload the latest release from the releases page or install from sources:
go install github.com/uptime-com/uptime-client-go/v2/cmd/upctl@latestObtain API token from Uptime.com and set it as an environment variable:
export UPCTL_TOKEN=your-api-tokengo get -u github.com/uptime-com/uptime-client-go/v2@latestgo test -v ./uptimeTo view godocs locally, run godoc. Open http://localhost:6060 in a web browser and navigate to the go-uptime package
under Third party.
The Uptime.com API Docs may also be a useful reference.
Please see the examples directory for usage examples.
Contributions are welcome! Please feel free to fork and submit a pull request with any improvements.
Original version was created by Kyle Gentle, with support from Elias Laham and the Dev Team at Uptime.com.
See contributors page.