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



At StatusCake we’ve got a powerful and ever-growing API which allows you to automate many tasks, and also to take advantage of functions that are not available in-app.
You can communicate with our API through most common coding languages, through this article we will provide code examples in terminal bash, PHP, and Python, as well as an example of how to manually run the commands through a common tool for such tasks: PostMan.
The first thing you need to bear in mind when using the API is that all of your calls will need to be validated using the Username and API key, both of these details can be found in the user details section of your account.
For the full list of settings that can be added along with your new test please check this page.
When using a the PHP curl method you’ll want something very similar to the code shown below, just replace the values with your desired parameters. You can see a full list of the available parameters here.
[blockquote align=”left” reverse=”off”]
// Enter your personal API key and Username to use for authentication , and also the data to insert
$API = “l6OxVJilcD2cETMoNRvn”;
$Username = “StatusCake”;
$InsertData = array(“WebsiteName”:”My new test”, “Paused” : 0, “WebsiteURL”: “https://www.statuscake.com”, “CheckRate” : “60”, “TestType” : “HTTP”);
// Create the CURL, set the options, remember to use the PUT request type and add the Username and API values to an array.
$ch = curl_init(“https://app.statuscake.com/API/Tests/Update”);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, “PUT”);
curl_setopt($ch, CURLOPT_POSTFIELDS,http_build_query($InsertData));
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
“API: “.$API,
“Username: “.$Username
));
// For Debugging, find out if something is going wrong
$Response = curl_exec($ch);
$Response = json_decode($Response);
// Check to see if everything has worked, and print a message indicating whether this was the case
if ($Response->Success == 1) {
echo ‘Inserted Test!’;
} else {
echo ‘Something Went Wrong<BR>’;
echo $Response->Message;
}
}
[/blockquote]
With this method we are looking at significantly less typing, it’s very important once again to ensure that this is always sent as a PUT request. The command should be run from a linux based system accessed through SSH or something similar.
[blockquote align=”left” reverse=”off”]
curl -H “API: APIKEY” -H “Username: USERNAME” -d “WebsiteName=MyNewSite&CheckRate=60&TestType=HTTP” -X PUT https://app.statuscake.com/API/Tests/Update
[/blockquote]
To send a the HTTP PUT request required for this functionality with Python we need to import and use the “requests” package.
[blockquote align=”left” reverse=”off”]
import requests
payload = {‘WebsiteName’:’MySite’, ‘TestType’:’HTTP’, ‘CheckRate’:60, ‘WebsiteURL’:’https://www.statuscake.com’}
headers = {‘API’: ‘KEYHERE’, ‘Username’: ‘USERNAMEHERE’}
url = ‘https://app.statuscake.com/API/Tests/Update’
r = requests.put(url, headers=headers, data=payload)
print(r.text)
[/blockquote]
Using Postman can be a good manual method, and a way of testing your settings before automating them. Below we’ve included an image showing an example of how to enter the details into the Postman software, API key and Username should be entered separately in the “Headers” section.
Share this
10 min read Whilst AI has compressed the visible stages of software delivery; requirements, validation, review and release discipline have not disappeared. They have been pushed into automation, runtime and governance. The real risk is not that the lifecycle is dead, but that organisations start acting as if accountability died with it. There is a now-familiar story about
4 min read How AI Is Shifting Software Engineering’s Primary Constraint For most of the history of software engineering, the primary constraint was production. Code was expensive, skilled engineers were scarce, and shipping features required concentrated human effort. Velocity was limited by how fast people could reason, implement, test, and deploy. That constraint shaped everything from team size,
5 min read Autonomous Code, Trust Boundaries, and Why Governance Now Matters More Than Ever In Part 1, we looked at how AI has reduced the cost of building monitoring tools. Then in Part 2, we explored the operational and economic burden of owning them. Now we need to talk about something deeper. Because the real shift isn’t
6 min read The Real Cost of Owning Monitoring Isn’t Code — It’s Everything Else In Part 1, we explored how AI has dramatically reduced the cost of building monitoring tooling. That much is clear. You can scaffold uptime checks quickly, generate alert logic in minutes, and set-up dashboards faster than most teams used to schedule the kickoff
5 min read AI Has Made Building Monitoring Easy. It Hasn’t Made Owning It Any Easier. A few months ago, I spoke to an engineering manager who proudly told me they had rebuilt their monitoring stack over a long weekend. They’d used AI to scaffold synthetic checks. They’d generated alert logic with dynamic thresholds. They’d then wired everything
3 min read In the previous posts, we’ve looked at how alert noise emerges from design decisions, why notification lists fail to create accountability, and why alerts only work when they’re designed around a clear outcome. Taken together, these ideas point to a broader conclusion. That alerting is not just a technical system, it’s a socio-technical one. Alerting
Find out everything you need to know in our new uptime monitoring whitepaper 2021