Introduction
Monitor your statuses
This documentation aims to provide all the information you need to work with our API.
Base URL
https://app.red-amber.green
Authenticating requests
To authenticate requests, include an Authorization
header with the value "Bearer {YOUR_AUTH_KEY}"
.
All authenticated endpoints are marked with a requires authentication
badge in the documentation below.
You can generate your token by visiting your dashboard Create API Token.
Monitors
You will create monitors via the developer portal, but once they are created, you can use this API from your own application to change the status and provide information to your user community.
Change monitor status to red.
requires authentication
Optionally (but preferably) provide additional information to give context to monitor viewers to take action. If successful, the monitor will be returned after being updated.
Example request:
curl --request POST \
"https://app.red-amber.green/api/monitor/3c83d3be-e72a-4e9c-92j6-785a135cb6e2/red" \
--header "Authorization: Bearer {YOUR_AUTH_KEY}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--data "{
\"message\": \"No more beer in stock!\",
\"more_info_url\": \"https:\\/\\/www.we-sell-beer.cheap\\/stockcontrol.\"
}"
const url = new URL(
"https://app.red-amber.green/api/monitor/3c83d3be-e72a-4e9c-92j6-785a135cb6e2/red"
);
const headers = {
"Authorization": "Bearer {YOUR_AUTH_KEY}",
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"message": "No more beer in stock!",
"more_info_url": "https:\/\/www.we-sell-beer.cheap\/stockcontrol."
}
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->post(
'https://app.red-amber.green/api/monitor/3c83d3be-e72a-4e9c-92j6-785a135cb6e2/red',
[
'headers' => [
'Authorization' => 'Bearer {YOUR_AUTH_KEY}',
'Accept' => 'application/json',
],
'json' => [
'message' => 'No more beer in stock!',
'more_info_url' => 'https://www.we-sell-beer.cheap/stockcontrol.',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
import requests
import json
url = 'https://app.red-amber.green/api/monitor/3c83d3be-e72a-4e9c-92j6-785a135cb6e2/red'
payload = {
"message": "No more beer in stock!",
"more_info_url": "https:\/\/www.we-sell-beer.cheap\/stockcontrol."
}
headers = {
'Authorization': 'Bearer {YOUR_AUTH_KEY}',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('POST', url, headers=headers, json=payload)
response.json()
Example response (200, Success):
{
"uuid": "d5c8405e-a374-4379-a978-e225b4e838a",
"created_at": "2021-07-28T08:33:06.000000Z",
"updated_at": "2021-08-19T13:57:58.000000Z",
"name": "BeerInStock",
"description": "Monitors the beer in stock.",
"status": "red",
"last_check": null,
"enabled": 1,
"message": "No more Heineken!",
"more_info_url": "https://www.we-sell-beer.cheap/stockcontrol"
}
Example response (401, NotFound):
{
"message": "Unable to find monitor using [foo-bar]. We tried uuid and name."
}
Received response:
Request failed with error:
Change monitor status to green.
requires authentication
Optionally (but preferably) provide additional information to give context to monitor viewers to take action. If successful, the monitor will be returned after being updated.
Example request:
curl --request POST \
"https://app.red-amber.green/api/monitor/3c83d3be-e72a-4e9c-92j6-785a135cb6e2/green" \
--header "Authorization: Bearer {YOUR_AUTH_KEY}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--data "{
\"message\": \"Only 2 beers left!\",
\"more_info_url\": \"https:\\/\\/www.we-sell-beer.cheap\\/stockcontrol.\"
}"
const url = new URL(
"https://app.red-amber.green/api/monitor/3c83d3be-e72a-4e9c-92j6-785a135cb6e2/green"
);
const headers = {
"Authorization": "Bearer {YOUR_AUTH_KEY}",
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"message": "Only 2 beers left!",
"more_info_url": "https:\/\/www.we-sell-beer.cheap\/stockcontrol."
}
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->post(
'https://app.red-amber.green/api/monitor/3c83d3be-e72a-4e9c-92j6-785a135cb6e2/green',
[
'headers' => [
'Authorization' => 'Bearer {YOUR_AUTH_KEY}',
'Accept' => 'application/json',
],
'json' => [
'message' => 'Only 2 beers left!',
'more_info_url' => 'https://www.we-sell-beer.cheap/stockcontrol.',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
import requests
import json
url = 'https://app.red-amber.green/api/monitor/3c83d3be-e72a-4e9c-92j6-785a135cb6e2/green'
payload = {
"message": "Only 2 beers left!",
"more_info_url": "https:\/\/www.we-sell-beer.cheap\/stockcontrol."
}
headers = {
'Authorization': 'Bearer {YOUR_AUTH_KEY}',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('POST', url, headers=headers, json=payload)
response.json()
Example response (200, Success):
{
"uuid": "d5c8405e-a374-4379-a978-e225b4e838a",
"created_at": "2021-07-28T08:33:06.000000Z",
"updated_at": "2021-08-19T13:57:58.000000Z",
"name": "BeerInStock",
"description": "Monitors the beer in stock.",
"status": "amber",
"last_check": null,
"enabled": 1,
"message": "Running low on Heineken. Plenty of Castle Lager available",
"more_info_url": "https://www.we-sell-beer.cheap/stockcontrol"
}
Example response (401, NotFound):
{
"message": "Unable to find monitor using [foo-bar]. We tried uuid and name."
}
Received response:
Request failed with error:
Change monitor status to amber.
requires authentication
Optionally provide additional information. If successful, the monitor will be returned after being updated.
Example request:
curl --request POST \
"https://app.red-amber.green/api/monitor/3c83d3be-e72a-4e9c-92j6-785a135cb6e2/amber" \
--header "Authorization: Bearer {YOUR_AUTH_KEY}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--data "{
\"message\": \"All fridges are full!\",
\"more_info_url\": \"https:\\/\\/www.we-sell-beer.cheap\\/stockcontrol.\"
}"
const url = new URL(
"https://app.red-amber.green/api/monitor/3c83d3be-e72a-4e9c-92j6-785a135cb6e2/amber"
);
const headers = {
"Authorization": "Bearer {YOUR_AUTH_KEY}",
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"message": "All fridges are full!",
"more_info_url": "https:\/\/www.we-sell-beer.cheap\/stockcontrol."
}
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->post(
'https://app.red-amber.green/api/monitor/3c83d3be-e72a-4e9c-92j6-785a135cb6e2/amber',
[
'headers' => [
'Authorization' => 'Bearer {YOUR_AUTH_KEY}',
'Accept' => 'application/json',
],
'json' => [
'message' => 'All fridges are full!',
'more_info_url' => 'https://www.we-sell-beer.cheap/stockcontrol.',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
import requests
import json
url = 'https://app.red-amber.green/api/monitor/3c83d3be-e72a-4e9c-92j6-785a135cb6e2/amber'
payload = {
"message": "All fridges are full!",
"more_info_url": "https:\/\/www.we-sell-beer.cheap\/stockcontrol."
}
headers = {
'Authorization': 'Bearer {YOUR_AUTH_KEY}',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('POST', url, headers=headers, json=payload)
response.json()
Example response (200, Success):
{
"uuid": "d5c8405e-a374-4379-a978-e225b4e838a",
"created_at": "2021-07-28T08:33:06.000000Z",
"updated_at": "2021-08-19T13:57:58.000000Z",
"name": "BeerInStock",
"description": "Monitors the beer in stock.",
"status": "green",
"last_check": null,
"enabled": 1,
"message": "All good. In stock on all items",
"more_info_url": "https://www.we-sell-beer.cheap/stockcontrol"
}
Example response (401, NotFound):
{
"message": "Unable to find monitor using [foo-bar]. We tried uuid and name."
}
Received response:
Request failed with error:
List available monitors.
requires authentication
Return values will be paginated, use the "next_page_url" link to retrieve additional monitors.
Example request:
curl --request GET \
--get "https://app.red-amber.green/api/monitors" \
--header "Authorization: Bearer {YOUR_AUTH_KEY}" \
--header "Content-Type: application/json" \
--header "Accept: application/json"
const url = new URL(
"https://app.red-amber.green/api/monitors"
);
const headers = {
"Authorization": "Bearer {YOUR_AUTH_KEY}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$response = $client->get(
'https://app.red-amber.green/api/monitors',
[
'headers' => [
'Authorization' => 'Bearer {YOUR_AUTH_KEY}',
'Accept' => 'application/json',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
import requests
import json
url = 'https://app.red-amber.green/api/monitors'
headers = {
'Authorization': 'Bearer {YOUR_AUTH_KEY}',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('GET', url, headers=headers)
response.json()
Example response (200, Success):
{
"current_page": 1,
"data": [
{
"uuid": "0d3800-d2cc-4b4c-8e67-96ed90a057c6",
"created_at": "2021-05-12T13:12:53.000000Z",
"updated_at": "2021-05-12T13:21:36.000000Z",
"name": "BeerInStock",
"description": "This will monitor stock levels in our online beer shop",
"enabled": 1
},
{
"uuid": "b81e8-94eb-4b9a-9126-915cce48c83c",
"created_at": "2021-05-12T13:13:17.000000Z",
"updated_at": "2021-07-09T12:28:55.000000Z",
"name": "Support Users Available",
"description": "Checks number of logged in support agents",
"enabled": 1
}
],
"first_page_url": "https://app.red-amber.green/api/monitors?page=1",
"from": 1,
"last_page": 1,
"last_page_url": "https://app.red-amber.green/api/monitors?page=1",
"links": [
{
"url": null,
"label": "« Previous",
"active": false
},
{
"url": "https://app.red-amber.green/api/monitors?page=1",
"label": "1",
"active": true
},
{
"url": null,
"label": "Next »",
"active": false
}
],
"next_page_url": null,
"path": "https://app.red-amber.green/api/monitors",
"per_page": 15,
"prev_page_url": null,
"to": 2,
"total": 2
}
Received response:
Request failed with error: