Bots Uptimes Guild - /guild

Methods used to retrieve info about uptime of your robots.

Base URL

https://api.watchbot.app

get
Uptime of monitored robots

https://api.watchbot.app/guild/:id
Obtain the uptime of your monitored robots in JSON format.
Request
Response
Request
Path Parameters
id
required
integer
The ID of the guild you are getting information about
Headers
AUTH-TOKEN
required
string
The guild's API token
Response
200: OK
If Uptime = null, is that there is no downtime recorded for the period. status = ["online", "idle", "offline", "dnd"].
{
"monitor": {
"ID_OF_ONE_BOT": {
"status": status,
"90days": Uptime,
"30days": Uptime,
"7days": Uptime
}
}
}

To get the authentication token, go to your server overview (https://dash.watchbot.app) and you will find it at the top.

Examples

NodeJS
Python
PHP
NodeJS
const fetch = require('node-fetch')
const serverID = ""
const apiToken = ""
fetch(`https://api.watchbot.app/guild/${serverID}`, {
headers: {
'AUTH-TOKEN': apiToken
}
})
.then(response => response.json())
.then(result => {
console.log(result)
})
Python
# Author : baptiste0928 (https://baptiste0928.net)
import aiohttp
import requests
from typing import Dict # Used for typing (optional)
import asyncio # Used for examples
def get_uptime(serverID: str, *, auth_token: str) -> Dict[str, str]:
"""Simple function to interact with the Watchbot api using requests."""
headers = {"AUTH-TOKEN": auth_token}
r = requests.get("https://api.watchbot.app/guild/" + serverID, headers=headers)
return r.json()
async def get_uptime_async(serverID: str, *, auth_token: str) -> Dict[str, str]:
"""Simple async function to interact with the Watchbot api using aiohttp."""
async with aiohttp.ClientSession() as session:
headers = {"AUTH-TOKEN": auth_token}
async with session.get("https://api.watchbot.app/guild/" + serverID, headers=headers) as r:
return await r.json()
# Usage example
serverID = ""
auth_token = ""
print(get_uptime(serverID, auth_token=auth_token))
print(asyncio.get_event_loop().run_until_complete(get_uptime_async(serverID, auth_token=auth_token)))
PHP
<?php
// Author : Adrien Luitot (https://adrien.luitot.fr)
$apiToken = ""; // Here put your token
$serverId = ""; // Here your server id
$curl = curl_init('https://api.watchbot.app/guild/' . $serverId);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($curl, CURLOPT_HTTPHEADER, ['AUTH-TOKEN: ' . $apiToken]);
$response = curl_exec($curl);
echo $response;
?>