UptimeTea

API Documentation

The UptimeTea API is easy to use and free for all plans.

Update maintenance window

Changes a maintenance window. Only the fields you send change.

PATCH https://api.uptimetea.com/maintenance_windows/:id

Headers

  • AuthorizationREQUIREDSTRING
    Bearer $TOKEN
  • Content-TypeREQUIREDSTRING
    application/json

Body parameters

  • maintenance_window.titleSTRING

    Window title.

  • maintenance_window.descriptionSTRING

    What is being done.

  • maintenance_window.start_timeSTRING

    Start, ISO 8601. startTime is accepted too.

  • maintenance_window.end_timeSTRING

    End, ISO 8601. endTime is accepted too.

  • maintenance_window.recurrence_ruleOBJECT

    Repeats the window: { frequency: daily | weekly | monthly, interval, days } where days are weekdays 0 (Sunday) to 6. null for a one-time window.

  • maintenance_window.watcher_idsARRAY

    Watchers silenced during the window. An empty array clears them. watcherIds is accepted too.

Response body

{
  "id": "uuid",
  "title": "Server Upgrade",
  "description": "Upgrading database servers",
  "start_time": "2024-01-20T02:00:00Z",
  "end_time": "2024-01-20T05:00:00Z",
  "recurrence_rule": {
    "frequency": "weekly",
    "interval": 1,
    "days": [6]
  },
  "active": false,
  "created_at": "2024-01-15T10:00:00Z",
  "watchers": [
    {
      "id": "uuid",
      "title": "My Website",
      "url": "https://example.com",
      "status": "success"
    }
  ]
}

Code examples

curl -X PATCH "https://api.uptimetea.com/maintenance_windows/$MAINTENANCE_WINDOW_ID" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "maintenance_window": {
      "end_time": "2024-01-20T05:00:00Z",
      "watcher_ids": ["uuid"]
    }
  }'
// Update maintenance window
const response = await fetch('https://api.uptimetea.com/maintenance_windows/MAINTENANCE_WINDOW_ID', {
  method: 'PATCH',
  headers: {
    'Authorization': 'Bearer ' + yourToken,
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    "maintenance_window": {
      "end_time": "2024-01-20T05:00:00Z",
      "watcher_ids": ["uuid"]
    }
  })
});

const data = await response.json();
console.log(data);
# Update maintenance window
import requests

headers = {'Authorization': f'Bearer {your_token}'}

response = requests.patch(
    'https://api.uptimetea.com/maintenance_windows/MAINTENANCE_WINDOW_ID',
    headers=headers,
    json={
        'maintenance_window': {
            'end_time': '2024-01-20T05:00:00Z',
            'watcher_ids': ['uuid']
        }
    }
)

print(response.json())
// Update maintenance window
package main

import (
    "fmt"
    "io"
    "net/http"
    "strings"
)

func main() {
    body := strings.NewReader(`{
      "maintenance_window": {
        "end_time": "2024-01-20T05:00:00Z",
        "watcher_ids": ["uuid"]
      }
    }`)
    req, _ := http.NewRequest("PATCH", "https://api.uptimetea.com/maintenance_windows/MAINTENANCE_WINDOW_ID", body)
    req.Header.Set("Authorization", "Bearer "+yourToken)
    req.Header.Set("Content-Type", "application/json")

    resp, err := http.DefaultClient.Do(req)
    if err != nil {
        panic(err)
    }
    defer resp.Body.Close()

    data, _ := io.ReadAll(resp.Body)
    fmt.Println(resp.Status, string(data))
}
# Update maintenance window
require 'net/http'
require 'uri'

uri = URI('https://api.uptimetea.com/maintenance_windows/MAINTENANCE_WINDOW_ID')
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true

request = Net::HTTP::Patch.new(uri)
request['Authorization'] = "Bearer #{your_token}"
request['Content-Type'] = 'application/json'
request.body = <<~JSON
  {
    "maintenance_window": {
      "end_time": "2024-01-20T05:00:00Z",
      "watcher_ids": ["uuid"]
    }
  }
JSON

response = http.request(request)
puts response.code, response.body
<?php
// Update maintenance window
$ch = curl_init('https://api.uptimetea.com/maintenance_windows/MAINTENANCE_WINDOW_ID');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PATCH');
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    'Authorization: Bearer ' . $yourToken,
    'Content-Type: application/json'
]);
curl_setopt($ch, CURLOPT_POSTFIELDS, <<<'JSON'
{
  "maintenance_window": {
    "end_time": "2024-01-20T05:00:00Z",
    "watcher_ids": ["uuid"]
  }
}
JSON);

$response = curl_exec($ch);
print_r(json_decode($response, true));
curl_close($ch);