GET /API/Tests/Periods

Basic Intro

Using the HTTP header GET you will be able to get a list of each period of data. A period of data is two time stamps in which status has remained the same - such as a period of downtime or uptime. If the end timestamp is the current date then that period is on going. Time stamps are returned in GMT format.

Parameters

REQUIRED POST/GET - TestID. This should be a int of a test ID attached to the logged in account.

OPTIONAL POST/GET - Additional - Also return information about the downtime. NOTE: This will slow down the query considerably.

Example Request
curl -H "API: [APIKey]" -H "Username: [Username]" -X GET https://app.statuscake.com/API/Tests/Periods

Example Output

The output is returned as a json array

{
    Start_Unix: "1361721706",   // When it started (Unix timestamp)
    End_Unix: "0",              // When it ended (Unix timestamp)
    Start: "2013-02-24 16:01:46", // When it started (Your timezone)
    End: "0000-00-00 00:00:00", // When it ended, or current time if still active (Your timezone)
    Type: "Status" // What this period describes.
}

Error Messages

If a testID is not connected to the account that API key has been provided for then the following error message will be presented

{
    ErrNo: 0,
    Access: false, // If access is denied to the TestID
    Client: "32", // What Client you have logged into
    TestID: "23311", // The TestID Provided
    Error: "Can not access data for that account. Was both Username and API Key provided and is the TestID correct?"
}

Changelog

2017-04-05: Added Start_Unix and End_Unix values to output.