REST API
Versioning and deprecation
The API is versioned in its path: /v1. Within a version WatchTower15 only adds.
The OpenAPI document
Section titled “The OpenAPI document”The contract is one file, https://developer.watchtower15.com/openapi/v1.json, the document the
reference is built from. The ingest API has its own document,
https://developer.watchtower15.com/openapi/ingest.json. Both are written by one command from the code that serves
them, so they cannot drift from it, and both are published under the MIT licence: anyone may generate, adapt and
publish a client from them.
The API host serves the same REST document itself, without a key, at https://rest.watchtower15.com/v1/openapi.json
(with an ETag, so a client that sends If-None-Match is answered 304 while it has not changed). Every /v1
answer names the document in a Link header, rel="service-desc", beside this site’s index of the Markdown
reference, https://developer.watchtower15.com/llms.txt, rel="service-doc":
Link: <https://developer.watchtower15.com/openapi/v1.json>; rel="service-desc", <https://developer.watchtower15.com/llms.txt>; rel="service-doc"info.version is 1.0.0+sha. followed by twelve hexadecimal digits: a fingerprint of the document’s content. It
changes whenever anything in the document changes, a description included, and it orders nothing: a different
fingerprint does not mean a newer or a breaking document, only a different one. Pin the fingerprint to know exactly
which contract a client was generated from.
Two things in it are promises a generated client can rely on:
operationIdis the operation’s name and never changes insidev1. It readspublic.servers.list,public.incidents.acknowledge, and so on, so a client can name its methods after it and keep them across releases.- Every enum is an open set, and says so. Wherever the document lists the values of a field, the field also
carries
x-wt15-open-enum: true. A generator should keep such a field a plain string (or an enum with a catch-all), never a closed list that fails on a value it does not know, because new values are added.
Three version numbers
Section titled “Three version numbers”v1is the API’s version. It is in every path and in the badge at the top of this site, and within it the API only grows.info.versionis each document’s fingerprint,1.0.0+sha.followed by twelve hexadecimal digits. It changes exactly when the contract does; Specifications shows each document’s.- Each SDK’s release number follows Semantic Versioning, independently of both. See SDKs.
The marks
Section titled “The marks”Beside the standard OpenAPI fields, the documents carry five marks a generator can read instead of guessing:
x-wt15-open-enum: trueon a field that lists values: keep it open, as above.x-wt15-instant: trueon an integer that holds a point in time, in epoch milliseconds, UTC.x-wt15-paged: trueon an operation that answers one page of a list. Its answer says how it pages: bypagewhen it hascurrent_page(withper_page,last_pageandtotal), bycursorwhen it hasnext_cursor, sent back ascursor.x-wt15-scopeson every operation: the list of scopes the API key needs (empty when none is needed, as on the ingest operations, where the token is the only credential).x-wt15-idempotent: trueon an operation that honours the optionalIdempotency-Keyheader.
What may be added to /v1
Section titled “What may be added to /v1”- New operations.
- New optional parameters.
- New fields in answers.
- New values in a field that lists values (an enum).
Write your client to ignore fields it does not know, and to treat an enum as an open set: an unknown value is not an error.
What is a breaking change
Section titled “What is a breaking change”Removing an operation, a field or an enum value, making an optional parameter required, or
changing what a field means. WatchTower15 does not make these inside /v1. They arrive as a
new operation or as /v2, and the old one keeps working for a stated period.
The one removal since the launch was WatchTower15’s own decision: the page lists’ cursor parameter and
next_cursor field, replaced by page and the page fields (current_page, per_page, last_page, total). Log
search, a custom metric’s samples and a service’s scans and runs keep cursor and next_cursor. See
pagination.
Retirement
Section titled “Retirement”When an operation or version is to be retired, its answers carry a Deprecation header from the
day it is announced and a Sunset header with the date it stops. Watch for them in your client’s
logs.
The reference always shows the current contract.