Guild - /guild
Methods used to retrieve info about uptime of your robots.

Base URL

1
https://api.watchbot.app
Copied!
get
https://api.watchbot.app
/guild/:id
Uptime of monitored robots
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
1
const fetch = require('node-fetch')
2
3
const serverID = ""
4
const apiToken = ""
5
6
fetch(`https://api.watchbot.app/guild/${serverID}`, {
7
headers: {
8
'AUTH-TOKEN': apiToken
9
}
10
})
11
.then(response => response.json())
12
.then(result => {
13
console.log(result)
14
})
Copied!
1
# Author : baptiste0928 (https://baptiste0928.net)
2
3
import aiohttp
4
import requests
5
from typing import Dict # Used for typing (optional)
6
import asyncio # Used for examples
7
8
def get_uptime(serverID: str, *, auth_token: str) -> Dict[str, str]:
9
"""Simple function to interact with the Watchbot api using requests."""
10
headers = {"AUTH-TOKEN": auth_token}
11
r = requests.get("https://api.watchbot.app/guild/" + serverID, headers=headers)
12
return r.json()
13
14
async def get_uptime_async(serverID: str, *, auth_token: str) -> Dict[str, str]:
15
"""Simple async function to interact with the Watchbot api using aiohttp."""
16
async with aiohttp.ClientSession() as session:
17
headers = {"AUTH-TOKEN": auth_token}
18
async with session.get("https://api.watchbot.app/guild/" + serverID, headers=headers) as r:
19
return await r.json()
20
21
# Usage example
22
serverID = ""
23
auth_token = ""
24
25
print(get_uptime(serverID, auth_token=auth_token))
26
27
print(asyncio.get_event_loop().run_until_complete(get_uptime_async(serverID, auth_token=auth_token)))
28
Copied!
1
<?php
2
3
// Author : Adrien Luitot (https://adrien.luitot.fr)
4
5
$apiToken = ""; // Here put your token
6
$serverId = ""; // Here your server id
7
8
$curl = curl_init('https://api.watchbot.app/guild/' . $serverId);
9
10
curl_setopt($curl, CURLOPT_RETURNTRANSFER, TRUE);
11
curl_setopt($curl, CURLOPT_HTTPHEADER, ['AUTH-TOKEN: ' . $apiToken]);
12
13
$response = curl_exec($curl);
14
echo $response;
15
16
?>
Copied!
Last modified 11mo ago