StatusCake API (1.0.0-beta.1)

Introduction

The StatusCake API is organised around the features that we offer, with each feature providing a set of endpoints to perform operations on resources associated with your account.

Authentication

The StatusCake API uses API keys to authenticate requests. You can view and manage your API keys from the StatusCake account panel.

All API requests must be made over HTTPS. Calls made over plain HTTP will be redirected to the secure endpoint. API requests without authentication will fail unless otherwise stated in the documentation for the specific endpoint.

api_key

Security Scheme Type API Key
Header parameter name: Authorization

For example an authenticated request must contain a HTTP header of the form Authorization: Bearer <API KEY>.

NOTE: API keys must be kept private. In the event that is it exposed a new one should be generated.

Ratelimits

Ratelimits are applied to the API to prevent any one client degrading the overall system stability. StatusCake accounts without a subscription, or those on a free plan, can make a maximum of 10 requests per second. For accounts with a paid subscription this limit is increaed to 20 requests per second.

Authenticated requests are associated with the authenticated account, regardless of which API key was used. This means that all API clients share the same ratelimit quota per second when they authenticate with different API keys owned by the same StatusCake account.

When the ratelimit quota is exceeded all future requests will return a HTTP 429 status until the ratelimit window is reset.

Cross-Origin Resource Sharing

The StatusCake API features Cross-Origin Resource Sharing (CORS) implemented in compliance with the W3C specification. This allows cross-domain communication from the browser. All responses have a wildcard same-origin which makes them completely public and accessible to everyone.

Errors

StatusCake uses conventional HTTP response codes to indicate the success or failure of an API request. In general: Codes in the 2xx range indicate success. Codes in the 4xx range indicate an error that failed given the information provided (e.g. a required parameter was omitted or malformed). Codes in the 5xx range indicate an error with StatusCake servers.

Handling Errors

Our client libraries raise exceptions, or return error types, depending on the control flow supported by the language. We recommend using these to write code that handles all possible API exceptions.

pagespeed

The Pagespeed API provides methods to operate on Pagespeed resources, effectively allowing tests to be created, read, updated, and deleted. In addition the history of a specific Pagespeed test can be returned for a given period.

Get all pagespeed tests

Returns a list of Pagespeed tests for an account.

Responses

Response Schema: application/json
required
Array of objects (PagespeedTest)

List of Pagespeed tests

Request samples

package main

import (
  "context"
  "fmt"

  "github.com/StatusCakeDev/statuscake-go"
)

func main() {
  client := statuscake.NewAPIClient("my-api-token")

  res, err := client.ListPagespeedTests(context.Background()).Execute()
  if err != nil {
    panic(err)
  }

  fmt.Printf("%+v\n", res.Data)
}

Response samples

Content type
application/json
{
  • "data": [
    ]
}

Create a pagespeed test

Creates a Pagespeed test with the given parameters.

Request Body schema: application/x-www-form-urlencoded
name
required
string

Name of the test

website_url
required
string <uri>

URL or IP address of the website under test

location_iso
required
string (PagespeedTestLocationISO)
Enum: "AU" "CA" "DE" "IN" "NL" "SG" "UK" "US" "PRIVATE"

Testing location

check_rate
required
integer (PagespeedTestCheckRate)
Enum: 1 5 10 15 30 60 1440

Number of minutes between tests

alert_bigger
integer <int32> >= 0
Default: 0

An alert will be sent if the size of the page is larger than this value (kb). A value of 0 prevents alerts being sent.

alert_slower
integer <int64> >= 0
Default: 0

An alert will be sent if the load time of the page exceeds this value (ms). A value of 0 prevents alerts being sent

alert_smaller
integer <int32> >= 0
Default: 0

An alert will be sent if the size of the page is smaller than this value (kb). A value of 0 prevents alerts being sent

contact_groups_csv
string

Comma separated list of contact group IDs

paused
boolean
Default: false

Whether the test should be run

Responses

Request samples

package main

import (
  "context"
  "fmt"

  "github.com/StatusCakeDev/statuscake-go"
)

func main() {
  client := statuscake.NewAPIClient("my-api-token")

  res, err := client.CreatePagespeedTest(context.Background()).
    Name("Example").
    WebsiteURL("https://www.example.com").
    LocationISO(statuscake.PagespeedTestLocationIOSUnitedKingdom).
    CheckRate(statuscake.PagespeedTestCheckRateTenMinutes).
    Execute()
  if err != nil {
    panic(err)
  }

  fmt.Printf("%+v\n", res.Data.NewID)
}

Response samples

Content type
application/json
{
  • "data": {
    }
}

Retrieve a pagespeed test

Returns a Pagespeed test with the given id.

path Parameters
test_id
required
string

Pagespeed test ID

Responses

Response Schema: application/json
required
object (PagespeedTest)

Request samples

package main

import (
  "context"
  "fmt"

  "github.com/StatusCakeDev/statuscake-go"
)

func main() {
  client := statuscake.NewAPIClient("my-api-token")

  res, err := client.GetPagespeedTest(context.Background(), "123").Execute()
  if err != nil {
    panic(err)
  }

  fmt.Printf("%+v\n", res.Data)
}

Response samples

Content type
application/json
{
  • "data": {
    }
}

Update a pagespeed test

Updates a Pagespeed test with the given parameters.

path Parameters
test_id
required
string

Pagespeed test ID

Request Body schema: application/x-www-form-urlencoded
name
string

Name of the test

location_iso
string (PagespeedTestLocationISO)
Enum: "AU" "CA" "DE" "IN" "NL" "SG" "UK" "US" "PRIVATE"

Testing location

check_rate
integer (PagespeedTestCheckRate)
Enum: 1 5 10 15 30 60 1440

Number of minutes between tests

alert_bigger
integer <int32> >= 0

An alert will be sent if the size of the page is larger than this value (kb). A value of 0 prevents alerts being sent.

alert_slower
integer <int64> >= 0

An alert will be sent if the load time of the page exceeds this value (ms). A value of 0 prevents alerts being sent

alert_smaller
integer <int32> >= 0

An alert will be sent if the size of the page is smaller than this value (kb). A value of 0 prevents alerts being sent

contact_groups_csv
string

Comma separated list of contact group IDs

paused
boolean

Whether the test should be run

Responses

Request samples

package main

import (
  "context"

  "github.com/StatusCakeDev/statuscake-go"
)

func main() {
  client := statuscake.NewAPIClient("my-api-token")

  err := client.UpdatePagespeedTest(context.Background(), "123").
    Name("Example").
    LocationISO(statuscake.PagespeedTestLocationIOSUnitedKingdom).
    CheckRate(statuscake.PagespeedTestCheckRateTenMinutes).
    Execute()
  if err != nil {
    panic(err)
  }
}

Response samples

Content type
application/json
{
  • "message": "Something went wrong",
  • "errors": { }
}

Delete a pagespeed test

Deletes a Pagespeed test with the given id.

path Parameters
test_id
required
string

Pagespeed test ID

Responses

Request samples

package main

import (
  "context"

  "github.com/StatusCakeDev/statuscake-go"
)

func main() {
  client := statuscake.NewAPIClient("my-api-token")

  err := client.DeletePagespeedTest(context.Background(), "123").Execute()
  if err != nil {
    panic(err)
  }
}

Response samples

Content type
application/json
{
  • "message": "Something went wrong",
  • "errors": { }
}

Get all pagespeed test history

Returns a list of PagespeedHistoryDay objects for the given Pagespeed test ID. This can optioanlly be limited to the past 1..30 days.

path Parameters
test_id
required
string

Pagespeed test ID

query Parameters
days
integer <int32> [ 1 .. 30 ]

Number of days to returns

Responses

Response Schema: application/json
required
object (PagespeedTestHistoryData)

Request samples

package main

import (
  "context"
  "fmt"

  "github.com/StatusCakeDev/statuscake-go"
)

func main() {
  client := statuscake.NewAPIClient("my-api-token")

  res, err := client.ListPagespeedTestHistory(context.Background(), "123").Execute()
  if err != nil {
    panic(err)
  }

  fmt.Printf("%+v\n", res.Data)
}

Response samples

Content type
application/json
{}

ssl

The SSL API provides methods to operate on SSL resources, effectively allowing tests to be created, read, updated, and deleted.

Get all SSL tests

Returns a list of SSL tests for an account.

Responses

Response Schema: application/json
required
Array of objects (SSLTest)

List of SSL tests

Request samples

package main

import (
  "context"
  "fmt"

  "github.com/StatusCakeDev/statuscake-go"
)

func main() {
  client := statuscake.NewAPIClient("my-api-token")

  res, err := client.ListSslTests(context.Background()).Execute()
  if err != nil {
    panic(err)
  }

  fmt.Printf("%+v\n", res.Data)
}

Response samples

Content type
application/json
{
  • "data": [
    ]
}

Create a SSL test

Creates an SSL test with the given parameters.

Request Body schema: application/x-www-form-urlencoded
website_url
required
string <uri>

URL of the website under test. Must begin with https://

check_rate
required
integer (SSLTestCheckRate)
Enum: 300 600 1800 3600 86400 2073600

Number of seconds between tests

contact_groups_csv
string

Comma separated list of contact group IDs

alert_at_csv
required
string

Comma separated list representing when alerts should be sent (days). Must be exactly 3 numerical values

alert_reminder
required
boolean

Whether to enable alert reminders

alert_expiry
required
boolean

Whether to enable alerts when the SSL certificate is to expire

alert_broken
required
boolean

Whether to enable alerts when SSL certificate issues are found

alert_mixed
required
boolean

Whether to enable alerts when mixed content is found

follow_redirects
boolean
Default: false

Whether to follow redirects when testing. Disabled by default

paused
boolean
Default: false

Whether the test should be run

hostname
string

Hostname of the server under test

user_agent
string

Custom user agent string set when testing

Responses

Request samples

package main

import (
  "context"
  "fmt"

  "github.com/StatusCakeDev/statuscake-go"
)

func main() {
  client := statuscake.NewAPIClient("my-api-token")

  res, err := client.CreateSslTest(context.Background()).
    WebsiteURL("https://www.example.com").
    CheckRate(statuscake.SSLTestCheckRateThirtyMinutes).
    AlertAt([]string{"1", "2", "3"}).
    AlertReminder(true).
    AlertExpiry(true).
    AlertBroken(true).
    AlertMixed(true).
    Execute()
  if err != nil {
    panic(err)
  }

  fmt.Printf("%+v\n", res.Data.NewID)
}

Response samples

Content type
application/json
{
  • "data": {
    }
}

Retrieve an SSL test

Returns an SSL test with the given id.

path Parameters
test_id
required
string

SSL test ID

Responses

Response Schema: application/json
required
object (SSLTest)

Request samples

package main

import (
  "context"
  "fmt"

  "github.com/StatusCakeDev/statuscake-go"
)

func main() {
  client := statuscake.NewAPIClient("my-api-token")

  res, err := client.GetSslTest(context.Background(), "123").Execute()
  if err != nil {
    panic(err)
  }

  fmt.Printf("%+v\n", res.Data)
}

Response samples

Content type
application/json
{
  • "data": {
    }
}

Update a SSL test

Updates an SSL test with the given parameters.

path Parameters
test_id
required
string

SSL test ID

Request Body schema: application/x-www-form-urlencoded
check_rate
integer (SSLTestCheckRate)
Enum: 300 600 1800 3600 86400 2073600

Number of seconds between tests

contact_groups_csv
string

Comma separated list of contact group IDs

alert_at_csv
string

Comma separated list representing when alerts should be sent (days). Must be exactly 3 numerical values

alert_reminder
boolean

Whether to enable alert reminders

alert_expiry
boolean

Whether to enable alerts when the SSL certificate is to expire

alert_broken
boolean

Whether to enable alerts when SSL certificate issues are found

alert_mixed
boolean

Whether to enable alerts when mixed content is found

follow_redirects
boolean

Whether to follow redirects when testing. Disabled by default

paused
boolean

Whether the test should be run

hostname
string

Hostname of the server under test

user_agent
string

Custom user agent string set when testing

Responses

Request samples

package main

import (
  "context"

  "github.com/StatusCakeDev/statuscake-go"
)

func main() {
  client := statuscake.NewAPIClient("my-api-token")

  err := client.UpdateSslTest(context.Background(), "123").
    CheckRate(statuscake.SSLTestCheckRateThirtyMinutes).
    AlertAt([]string{"1", "2", "3"}).
    AlertReminder(true).
    AlertExpiry(true).
    AlertBroken(true).
    AlertMixed(true).
    Execute()
  if err != nil {
    panic(err)
  }
}

Response samples

Content type
application/json
{
  • "message": "Something went wrong",
  • "errors": { }
}

Delete a SSL test

Deletes an SSL test with the given id.

path Parameters
test_id
required
string

Pagespeed test ID

Responses

Request samples

package main

import (
  "context"

  "github.com/StatusCakeDev/statuscake-go"
)

func main() {
  client := statuscake.NewAPIClient("my-api-token")

  err := client.DeleteSslTest(context.Background(), "123").Execute()
  if err != nil {
    panic(err)
  }
}

Response samples

Content type
application/json
{
  • "message": "Something went wrong",
  • "errors": { }
}

uptime

The Uptime API provides methods to operate on Uptime resources, effectively allowing tests to be created, read, updated, and deleted. In addition the Uptime API is able to configure maintenance windows; return a history of uptime status for a given period; and return a history of alerts since a given date.

NOTE: the API endpoints concerned with maintenance windows will only work with accounts registed to use the newer version of maintenance windows. This version of maintenance windows is incompatible with the original version and all existing windows will require migrating to be further used. Presently a tool to automate the migration of maintenance windows is under development.

Get all uptime tests

Returns a list of uptime tests for an account. Pagination fields are only returned if the account associated with the API key is part of the uptime beta group.

query Parameters
status
string
Enum: "down" "up"

Uptime test status

page
integer <int32> >= 1
Default: 1

Page of results

limit
integer <int32> [ 1 .. 100 ]
Default: 100

The number of results to return per page

tags
string

Comma separated list of tags assocaited with a test

matchany
boolean
Default: false

Include uptime tests in response that match any specified tag or all tags

nouptime
boolean
Default: false

Do not calculate uptime percentages for results

Responses

Response Schema: application/json
required
Array of objects (UptimeTestOverview)

List of Uptime tests

object (Metadata)

Request samples

package main

import (
  "context"
  "fmt"

  "github.com/StatusCakeDev/statuscake-go"
)

func main() {
  client := statuscake.NewAPIClient("my-api-token")

  res, err := client.ListUptimeTests(context.Background()).Execute()
  if err != nil {
    panic(err)
  }

  fmt.Printf("%+v\n", res.Data)
}

Response samples

Content type
application/json
{
  • "data": [
    ],
  • "metadata": {
    }
}

Create an uptime test

Creates an Uptime test with the given parameters.

Request Body schema: application/x-www-form-urlencoded
name
required
string

Name of the test

test_type
required
string (UptimeTestType)
Enum: "DNS" "HEAD" "HTTP" "PING" "SSH" "TCP"

Uptime test type

website_url
required
string <uri>

URL or IP address of the website under test

check_rate
required
integer (UptimeTestCheckRate)
Enum: 0 30 60 300 900 1800 3600 86400

Number of seconds between tests

basic_user
string

Basic authentication username

basic_pass
string

Basic authentication password

confirmation
integer <int32> [ 0 .. 3 ]
Default: 2

Number of confirmation servers to confirm downtime before an alert is triggered

contact_groups_csv
string

Comma separated list of contact group IDs

custom_header
string

JSON object. Represents headers to be sent when making requests

do_not_find
boolean

Whether to consider the test as down if the string in FindString is present within the response

dns_ip_csv
string

Comma separated list of IP addresses to compare against returned DNS records

dns_server
string

Hostname or IP address of the nameserver to query

enable_ssl_alert
boolean

Send an alert if the SSL certificate is soon to expire

final_endpoint
string

Specify where the redirect chain should end

find_string
string

String to look for within the response. Considered down if not found

follow_redirects
boolean

Allow tests to follow redirects

host
string

Name of the hosting provider

include_header
boolean

Include header content in string match search

paused
boolean
Default: false

Whether the test should be run

port
integer <int32> >= 0

Destination port for TCP tests

post_body
string

JSON object. This is converted to form data on request

post_raw
string

Raw HTTP POST string to send to the server

regions
Array of strings

List of regions on which to run tests. The values required for this parameter can be retrieved from the GET /v1/uptime-locations endpoint.

status_codes_csv
string

Comma separated list of status codes that trigger an alert

tags_csv
string

Comma separated list of tags

timeout
integer <int32> >= 0
Default: 40

How long to wait to receive the first byte

trigger_rate
integer <int32> >= 0
Default: 4

The number of minutes to wait before sending an alert

use_jar
boolean

Enable cookie storage

user_agent
string

User agent to be used when making requests

Responses

Request samples

package main

import (
  "context"
  "fmt"

  "github.com/StatusCakeDev/statuscake-go"
)

func main() {
  client := statuscake.NewAPIClient("my-api-token")

  res, err := client.CreateUptimeTest(context.Background()).
    Name("example HTTP test").
    TestType(statuscake.UptimeTestTypeHTTP).
    WebsiteURL("https://www.example.com").
    CheckRate(statuscake.UptimeTestCheckRateThirtyMinutes).
    Execute()
  if err != nil {
    panic(err)
  }

  fmt.Printf("%+v\n", res.Data.NewID)
}

Response samples

Content type
application/json
{
  • "data": {
    }
}

Retrieve an uptime test

Returns an Uptime test with the given id.

path Parameters
test_id
required
string

Uptime test ID

Responses

Response Schema: application/json
required
object (UptimeTest)

Request samples

package main

import (
  "context"
  "fmt"

  "github.com/StatusCakeDev/statuscake-go"
)

func main() {
  client := statuscake.NewAPIClient("my-api-token")

  res, err := client.GetUptimeTest(context.Background(), "123").Execute()
  if err != nil {
    panic(err)
  }

  fmt.Printf("%+v\n", res.Data)
}

Response samples

Content type
application/json
{
  • "data": {
    }
}

Update an uptime test

Updates an Uptime test with the given parameters.

path Parameters
test_id
required
string

Uptime test ID

Request Body schema: application/x-www-form-urlencoded
basic_user
string

Basic authentication username

basic_pass
string

Basic authentication password

check_rate
integer (UptimeTestCheckRate)
Enum: 0 30 60 300 900 1800 3600 86400

Number of seconds between tests

confirmation
integer <int32> [ 0 .. 3 ]

Number of confirmation servers to confirm downtime before an alert is triggered

contact_groups_csv
string

Comma separated list of contact group IDs

custom_header
string

JSON object. Represents headers to be sent when making requests

do_not_find
boolean

Whether to consider the test as down if the string in FindString is present within the response

dns_ip_csv
string

Comma separated list of IP addresses to compare against returned DNS records

dns_server
string

Hostname or IP address of the nameserver to query

enable_ssl_alert
boolean

Send an alert if the SSL certificate is soon to expire

final_endpoint
string

Specify where the redirect chain should end

find_string
string

String to look for within the response. Considered down if not found

follow_redirects
boolean

Allow tests to follow redirects

host
string

Name of the hosting provider

include_header
boolean

Include header content in string match search

name
string

Name of the test

paused
boolean

Whether the test should be run

port
integer <int32> >= 0

Destination port for TCP tests

post_body
string

JSON object. This is converted to form data on request

post_raw
string

Raw HTTP POST string to send to the server

regions
Array of strings

List of regions on which to run tests. The values required for this parameter can be retrieved from the GET /v1/uptime-locations endpoint.

status_codes_csv
string

Comma separated list of status codes that trigger an alert

tags_csv
string

Comma separated list of tags

timeout
integer <int32> >= 0

How long to wait to receive the first byte

trigger_rate
integer <int32> >= 0

The number of minutes to wait before sending an alert

use_jar
boolean

Enable cookie storage

user_agent
string

User agent to be used when making requests

Responses

Request samples

package main

import (
  "context"

  "github.com/StatusCakeDev/statuscake-go"
)

func main() {
  client := statuscake.NewAPIClient("my-api-token")

  err := client.UpdateUptimeTest(context.Background(), "123").
    Name("example HTTP test").
    CheckRate(statuscake.UptimeTestCheckRateThirtyMinutes).
    Execute()
  if err != nil {
    panic(err)
  }
}

Response samples

Content type
application/json
{
  • "message": "Something went wrong",
  • "errors": { }
}

Delete an uptime test

Deletes an Uptime test with the given id.

path Parameters
test_id
required
string

Uptime test ID

Responses

Request samples

package main

import (
  "context"

  "github.com/StatusCakeDev/statuscake-go"
)

func main() {
  client := statuscake.NewAPIClient("my-api-token")

  err := client.DeleteUptimeTest(context.Background(), "123").Execute()
  if err != nil {
    panic(err)
  }
}

Response samples

Content type
application/json
{
  • "message": "Something went wrong",
  • "errors": { }
}

Get all uptime test history

Returns a list of Uptime test history results for a given uptime test id, detailing the test runs performed on the StatusCake testing infrastruture.

path Parameters
test_id
required
string

Uptime test ID

query Parameters
start
integer <int64> >= 0

Only results since this UNIX timestamp will be returned

end
integer <int64> >= 0

Only results up to this UNIX timestamp will be returned

limit
integer <int32> [ 1 .. 1500 ]
Default: 100

The number of results to return

Responses

Response Schema: application/json
required
object

Request samples

package main

import (
  "context"
  "fmt"

  "github.com/StatusCakeDev/statuscake-go"
)

func main() {
  client := statuscake.NewAPIClient("my-api-token")

  res, err := client.ListUptimeTestHistory(context.Background(), "123").Execute()
  if err != nil {
    panic(err)
  }

  fmt.Printf("%+v\n", res.Data)
}

Response samples

Content type
application/json
{
  • "data": {
    }
}

Get all uptime test periods

Returns a list of Uptime test periods for a given uptime test id, detailing the creation time of the test period, when it ended and the duration.

A maximum of 20 results will be returned. This is to reduce performance issues when making requests for uptime tests with a large number of test periods.

path Parameters
test_id
required
string

Uptime test ID

Responses

Response Schema: application/json
required
Array of objects (UptimeTestPeriod)

List of uptime test periods

Request samples

package main

import (
  "context"
  "fmt"

  "github.com/StatusCakeDev/statuscake-go"
)

func main() {
  client := statuscake.NewAPIClient("my-api-token")

  res, err := client.ListUptimeTestPeriods(context.Background(), "123").Execute()
  if err != nil {
    panic(err)
  }

  fmt.Printf("%+v\n", res.Data)
}

Response samples

Content type
application/json
{
  • "data": [
    ]
}

Get all sent uptime alerts

Returns a list of Uptime alerts for an account. This list can be filtered by the given id.

path Parameters
test_id
required
string

Uptime test ID

query Parameters
start
integer <int64> >= 0

Only results since this UNIX timestamp will be returned

limit
integer <int32> >= 1

The number of results to return

Responses

Response Schema: application/json
required
Array of objects (UptimeTestAlert)

List of uptime test alerts

Request samples

package main

import (
  "context"
  "fmt"

  "github.com/StatusCakeDev/statuscake-go"
)

func main() {
  client := statuscake.NewAPIClient("my-api-token")

  res, err := client.ListSentAlerts(context.Background(), "123").Execute()
  if err != nil {
    panic(err)
  }

  fmt.Printf("%+v\n", res.Data)
}

Response samples

Content type
application/json
{
  • "data": [
    ]
}

Get all maintenance windows

Returns a list of maintenance windows for an account.

query Parameters
state
string
Enum: "active" "paused" "pending"

Maintenance window state

Responses

Response Schema: application/json
required
Array of objects (MaintenanceWindow)

List of maintenance windows

Request samples

package main

import (
  "context"
  "fmt"

  "github.com/StatusCakeDev/statuscake-go"
)

func main() {
  client := statuscake.NewAPIClient("my-api-token")

  res, err := client.ListMaintenanceWindows(context.Background()).Execute()
  if err != nil {
    panic(err)
  }

  fmt.Printf("%+v\n", res.Data)
}

Response samples

Content type
application/json
{
  • "data": [
    ]
}

Create a maintenance window

Creates a maintenance window with the given parameters.

Request Body schema: application/x-www-form-urlencoded
name
required
string

Name of the maintenance window

start_at
required
string <date-time>

Start of the maintenance window (RFC3339 format)

end_at
required
string <date-time>

End of the maintenance window (RFC3339 format)

repeat_interval
string (MaintenanceWindowRepeatInterval)
Enum: "never" "1d" "1w" "2w" "1m"

How often the maintenance window should occur

tests_csv
string

Comma separated list of uptime test IDs explicitly included in this maintenance window. At least one of tests_csv and tags_csv must be present in the request

tags_csv
string

Comma separated list of tags used to include matching uptime test in this maintenance window. At least one of tests_csv and tags_csv must be present in the request

timezone
required
string

Standard timezone associated with this maintenance

Responses

Request samples

package main

import (
  "context"
  "fmt"

  "github.com/StatusCakeDev/statuscake-go"
)

func main() {
  client := statuscake.NewAPIClient("my-api-token")

  res, err := client.CreateMaintenanceWindow(context.Background()).
    Name("Weekends").
    Start(1603497600).
    End(1603670399).
    Timezone("UTC").
    Execute()
  if err != nil {
    panic(err)
  }

  fmt.Printf("%+v\n", res.Data.NewID)
}

Response samples

Content type
application/json
{
  • "data": {
    }
}

Retrieve a maintenance window

Returns a maintenance window with the given id.

path Parameters
window_id
required
string

Maintenance window ID

Responses

Response Schema: application/json
required
object (MaintenanceWindow)

Request samples

package main

import (
  "context"
  "fmt"

  "github.com/StatusCakeDev/statuscake-go"
)

func main() {
  client := statuscake.NewAPIClient("my-api-token")

  res, err := client.GetMaintenanceWindow(context.Background(), "123").Execute()
  if err != nil {
    panic(err)
  }

  fmt.Printf("%+v\n", res.Data)
}

Response samples

Content type
application/json
{
  • "data": {
    }
}

Update a maintenance window

Updates a maintenance window with the given parameters.

path Parameters
window_id
required
string

Maintenance window ID

Request Body schema: application/x-www-form-urlencoded
name
string

Name of the maintenance window

start_at
string <date-time>

Start of the maintenance window (RFC3339 format)

end_at
string <date-time>

End of the maintenance window (RFC3339 format)

repeat_interval
string (MaintenanceWindowRepeatInterval)
Enum: "never" "1d" "1w" "2w" "1m"

How often the maintenance window should occur

tests_csv
string

Comma separated list of uptime test IDs explicitly included in this maintenance window

tags_csv
string

Comma separated list of tags used to include matching uptime test in this maintenance window

timezone
string

Standard timezone associated with this maintenance

Responses

Request samples

package main

import (
  "context"

  "github.com/StatusCakeDev/statuscake-go"
)

func main() {
  client := statuscake.NewAPIClient("my-api-token")

  err := client.UpdateMaintenanceWindow(context.Background(), "123").
    Name("Weekdays").
    Execute()
  if err != nil {
    panic(err)
  }
}

Response samples

Content type
application/json
{
  • "message": "Something went wrong",
  • "errors": { }
}

Delete a maintenance window

Deletes a maintenance window with the given id.

path Parameters
window_id
required
string

Maintenance window ID

Responses

Request samples

package main

import (
  "context"

  "github.com/StatusCakeDev/statuscake-go"
)

func main() {
  client := statuscake.NewAPIClient("my-api-token")

  err := client.DeleteMaintenanceWindow(context.Background(), "123").Execute()
  if err != nil {
    panic(err)
  }
}

Response samples

Content type
application/json
{
  • "message": "Something went wrong",
  • "errors": { }
}

contact groups

The contact groups API provides methods to configure how StatusCake alerts are forwarded to the people that need to see them.

Get all contact groups

Returns a list of contact groups for an account.

Responses

Response Schema: application/json
required
Array of objects (ContactGroup)

List of contact groups

Request samples

package main

import (
  "context"
  "fmt"

  "github.com/StatusCakeDev/statuscake-go"
)

func main() {
  client := statuscake.NewAPIClient("my-api-token")

  res, err := client.ListContactGroups(context.Background()).Execute()
  if err != nil {
    panic(err)
  }

  fmt.Printf("%+v\n", res.Data)
}

Response samples

Content type
application/json
{}

Create a contact group

Creates a contact group with the given parameters.

Request Body schema: application/x-www-form-urlencoded
name
required
string

Name of the contact group

ping_url
string <uri>

URL or IP address of an endpoint to push uptime events. Currently this only supports HTTP GET endpoints

email_addresses_csv
string

Comma separated list of email addresses

mobile_numbers_csv
string

Comma separated list of international format mobile phone numbers

integrations_csv
string

Comma separated list of integration IDs

Responses

Request samples

package main

import (
  "context"
  "fmt"

  "github.com/StatusCakeDev/statuscake-go"
)

func main() {
  client := statuscake.NewAPIClient("my-api-token")

  res, err := client.CreateContactGroup(context.Background()).
    Name("Operations Team").
    EmailAddresses([]string{
      "[email protected]",
      "[email protected]",
    }).
    Execute()
  if err != nil {
    panic(err)
  }

  fmt.Printf("%+v\n", res.Data.NewID)
}

Response samples

Content type
application/json
{
  • "data": {
    }
}

Retrieve a contact group

Returns a contact group with the given id.

path Parameters
group_id
required
string

Contact group ID

Responses

Response Schema: application/json
required
object (ContactGroup)

Request samples

package main

import (
  "context"
  "fmt"

  "github.com/StatusCakeDev/statuscake-go"
)

func main() {
  client := statuscake.NewAPIClient("my-api-token")

  res, err := client.GetContactGroup(context.Background(), "123").Execute()
  if err != nil {
    panic(err)
  }

  fmt.Printf("%+v\n", res.Data)
}

Response samples

Content type
application/json
{}

Update a contact group

Updates a contact group with the given parameters.

path Parameters
group_id
required
string

Contact group ID

Request Body schema: application/x-www-form-urlencoded
name
string

Name of the contact group

ping_url
string <uri>

URL or IP address of an endpoint to push uptime events. Currently this only supports HTTP GET endpoints

email_addresses_csv
string

Comma separated list of email addresses

mobile_numbers_csv
string

Comma separated list of international format mobile phone numbers

integrations_csv
string

Comma separated list of integration IDs

Responses

Request samples

package main

import (
  "context"

  "github.com/StatusCakeDev/statuscake-go"
)

func main() {
  client := statuscake.NewAPIClient("my-api-token")

  err := client.UpdateContactGroup(context.Background(), "123").
    Name("Operations Team").
    EmailAddresses([]string{
      "[email protected]",
      "[email protected]",
    }).
    Execute()
  if err != nil {
    panic(err)
  }
}

Response samples

Content type
application/json
{
  • "message": "Something went wrong",
  • "errors": { }
}

Delete a contact group

Deletes a contact group with the given id.

path Parameters
group_id
required
string

Contact group ID

Responses

Request samples

package main

import (
  "context"

  "github.com/StatusCakeDev/statuscake-go"
)

func main() {
  client := statuscake.NewAPIClient("my-api-token")

  err := client.DeleteContactGroup(context.Background(), "123").Execute()
  if err != nil {
    panic(err)
  }
}

Response samples

Content type
application/json
{
  • "message": "Something went wrong",
  • "errors": { }
}

locations

The Locations API returns details of our testing infrastructure. This may be used to gather information regarding IP addresses that may need to be allowed through your firewalls for tests to be succesful.

Get all uptime monitoring locations

Returns a list of locations detailing server information for Uptime Monitoring testing servers. This information can be used to create further tests using the API.

query Parameters
best
boolean
Default: false

Return only locations with the least number of tests

location
string

Country ISO

Responses

Response Schema: application/json
required
Array of objects (MonitoringLocation)

List of monitoring locations

Request samples

package main

import (
  "context"
  "fmt"

  "github.com/StatusCakeDev/statuscake-go"
)

func main() {
  client := statuscake.NewAPIClient("my-api-token")

  res, err := client.ListUptimeMonitoringLocations(context.Background()).Execute()
  if err != nil {
    panic(err)
  }

  fmt.Printf("%+v\n", res.Data)
}

Response samples

Content type
application/json
{
  • "data": [
    ]
}

Get all pagespeed monitoring locations

Returns a list of locations detailing server information for Pagespeed Monitoring testing servers. This information can be used to create further tests using the API.

query Parameters
best
boolean
Default: false

Return only locations with the least number of tests

location
string

Country ISO

Responses

Response Schema: application/json
required
Array of objects (MonitoringLocation)

List of monitoring locations

Request samples

package main

import (
  "context"
  "fmt"

  "github.com/StatusCakeDev/statuscake-go"
)

func main() {
  client := statuscake.NewAPIClient("my-api-token")

  res, err := client.ListPagespeedMonitoringLocations(context.Background()).Execute()
  if err != nil {
    panic(err)
  }

  fmt.Printf("%+v\n", res.Data)
}

Response samples

Content type
application/json
{
  • "data": [
    ]
}