Want to know how much website downtime costs, and the impact it can have on your business?
Find out everything you need to know in our new uptime monitoring whitepaper 2021
In this post, we’ll take you through how to list tests from your account, and their detailed settings through the API. There are two functions involved here, first is the function that lists ALL tests on the account with important settings, and second is a more detailed call for a single test. As usual, we’ll take you through this process for both of these using PHP, bash, Python, and Postman.
[blockquote align=”left” reverse=”off”]
<?php
// Auth the request
$API = “l6OxVJilcD2cETMoNRvn”;
$Username = “StatusCake”;
// Create the CURL
$ch = curl_init(“https://app.statuscake.com/API/Tests/”);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, “POST”);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
“API: “.$API,
“Username: “.$Username
));
// For Debugging
$Response = curl_exec($ch);
$Response = json_decode($Response);
// Check for success
if (!empty($Response->Success) && $Response->Success == 1) {
echo ‘Here’s the detailed data!’;
echo $Response;
echo ‘Here’s the data!’;
echo $Response;
} else {
echo ‘Something Went Wrong Grabbing the Data<BR>’;
echo $Response->Message;
}
?> [/blockquote]
[blockquote align=”left” reverse=”off”]
<?php
// Auth the request
$API = “l6OxVJilcD2cETMoNRvn”;
$Username = “StatusCake”;
$TestID = TESTIDHERE;
// Create the CURL
$ch = curl_init(“https://app.statuscake.com/API/Tests/Details/?TestID=” . $TestID);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, “POST”);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
“API: “.$API,
“Username: “.$Username
));
// For Debugging
$Response = curl_exec($ch);
$Response = json_decode($Response);
// Check for success
if (!empty($Response->Success) && $Response->Success == 1) {
echo ‘Here’s the detailed data!’;
echo $Response;
} else {
echo ‘Something Went Wrong Grabbing the details<BR>’;
echo $Response->Message;
}
?>
[/blockquote]
[blockquote align=”left” reverse=”off”]
curl -H “API: [APIKey]” -H “Username: [Username]” -X GET https://app.statuscake.com/API/Tests/Details/?TestID=TESTIDHERE[/blockquote]
[blockquote align=”left” reverse=”off”]
curl –H “API: [APIKey]” –H “Username: [Username]” –X GET https://app.statuscake.com/API/Tests/[/blockquote]
[blockquote align=”left” reverse=”off”]
# -*- coding: utf-8 -*-
import requests
headers = {‘API’: ‘APIKEYHERE’,’Username’: ‘USERNAMEHERE’}
url = ‘https://app.statuscake.com/API/Tests/’
r = requests(url, headers=headers)
print(r.text)[/blockquote]
[blockquote align=”left” reverse=”off”]
# -*- coding: utf-8 -*-
import requests
headers = {‘API’: ‘APIKEYHERE’,’Username’: ‘USERNAMEHERE’}
url = ‘https://app.statuscake.com/API/Tests/Details/?TestID=TESTIDHERE’
r = requests.get(url, headers=headers)
print(r.text) [/blockquote]
Share this
3 min read For any web developer, DevTools provides an irreplaceable aid to debugging code in all common browsers. Both Safari and Firefox offer great solutions in terms of developer tools, however in this post I will be talking about the highlights of the most recent features in my personal favourite browser for coding, Chrome DevTools. For something
6 min read There has certainly been a trend recently of using animations to elevate user interfaces and improve user experiences, and the more subtle versions of these are known as micro animations. Micro animations are an understated way of adding a little bit of fun to everyday user interactions such as hovering over a link, or clicking
2 min read Read about the latest websites that have experienced downtime including Netflix, Twitter, Facebook and more inside!
2 min read Read about how Google suffered an outage due to the soaring temperatures in the UK in July and how they rectified it right here!
3 min read See the results of our website downtime survey to see some of the most shocking and surprising stats! You won’t be disappointed.
6 min read Find out everything you need to know about Dark Mode and what you can do, as a developer, to make it easier to use.
Find out everything you need to know in our new uptime monitoring whitepaper 2021