### Authenticated HTTP Request Example (API v1) Source: https://www.statuscake.com/kb/knowledge-base/api-migration-guide Demonstrates the structure of an authenticated HTTP GET request to the StatusCake API v1, including the Host and Authorization headers. Authentication is now solely handled by the 'Authorization' header with an API key. ```HTTP GET /v1/uptime-locations HTTP/2 Host: api.statuscake.com Authorization: Bearer abc123 ``` -------------------------------- ### Failed Authentication Response Example (API v1) Source: https://www.statuscake.com/kb/knowledge-base/api-migration-guide Illustrates the HTTP response received when an authentication attempt to the StatusCake API v1 fails. This response includes a 403 status code and an 'x-ext-authz: denied' header. ```HTTP HTTP/2 403 x-ext-authz: denied ``` -------------------------------- ### JSON Payload Example for POST Data Source: https://www.statuscake.com/kb/knowledge-base/how-to-send-post-data This example demonstrates the correct JSON format required for the 'Form Post' textarea in StatusCake. It shows how to structure key-value pairs for submitting data, such as login credentials. ```json { "Username": "Daniel", "Password": "Frog" } ``` -------------------------------- ### API Request Routes Source: https://www.statuscake.com/kb/knowledge-base/api-migration-guide Each HTTP operation now has a dedicated endpoint. For example, `POST /v1/uptime` creates a test, and `PUT /v1/uptime/:id` updates an existing test. ```APIDOC ## Request Routes ### Description Each HTTP operation now has its own dedicated endpoint. Unlike previously where a single endpoint may have been shared for `POST`, `PUT` and sometimes `DELETE` operations, the API now separates these and allows for conventional HTTP semantics. ### Example - To create an Uptime monitoring test: `POST /v1/uptime` - To update an Uptime monitoring test: `PUT /v1/uptime/:id` ``` -------------------------------- ### Get All Public Reporting Pages Source: https://www.statuscake.com/kb/knowledge-base/using-the-public-reporting-api Lists all public reporting pages associated with the account. ```APIDOC ## GET /API/PublicReporting/ ### Description Lists all public reporting pages on the account. ### Method GET ### Endpoint /API/PublicReporting/ ### Parameters #### Query Parameters None ### Request Example None ### Response #### Success Response (200) - **pages** (Array) - An array of public reporting page objects. #### Response Example ```json { "pages": [ { "id": "PUBLIC_ID_1", "title": "Example Page 1" }, { "id": "PUBLIC_ID_2", "title": "Example Page 2" } ] } ``` ``` -------------------------------- ### API Pagination Source: https://www.statuscake.com/kb/knowledge-base/api-migration-guide For endpoints that support pagination, metadata including page number, items per page, total pages, and total items is returned in a `metadata` object. ```APIDOC ## Pagination ### Description For endpoints that support it, pagination data is returned within a `metadata` object within the JSON response. ### Response Structure - **data** (array) - The array of resources. - **metadata** (object) - Contains pagination details. - **page** (integer) - The current page number. - **per_page** (integer) - The number of items per page. - **page_count** (integer) - The total number of pages. - **total_count** (integer) - The total number of items. ### Response Example ```json { "data": [ ... ], "metadata": { "page": 1, "per_page": 1, "page_count": 1, "total_count": 1 } } ``` ```