Cabinhub News API v1.0.0

Docs / Get Topic

Get Topic

Get Topic

GET/v1/site/topics/{slug}
Auth
none
Cache-Control
public, max-age=30, stale-while-revalidate=150, stale-if-error=300; no-store on 404
Validators
ETag, Last-Modified
Source of truth
clients/openapi.json and docs/API.md §12

One subject page: the fixed intro, the stories, why each is here, and the filters.

The filters are answered HERE, in one body, so the page can be linked, shared and reloaded in the state the reader left it in — `#/topic/fed?window=7d&category=macro is a URL, not a client-side guess. counts reports the size of every filter combination before the page is truncated, so a chip is a fact and not decoration. pagination` reports the page, page size, page count and both neighbours, so a reader (or a client) can walk the whole archive instead of the first page of it.

Description: clients/openapi.json

Parameters

NameInRequiredTypeExampleNotes
slugpathyesstringfederal-reserve
localequerynostringenOne locale; omit for every locale
limitquerynostring2Defaults to 24, capped at 60
windowquerynostringall | 30d | 7d | 24h
categoryquerynostringcentral_banksKeep only stories from this beat
sortquerynostringnewest (default) | oldest
pagequerynostring11-based archive page; page 1 is page 1

Example request

curl
Shell
curl -sS \
  'https://vg.tempproject.online/v1/site/topics/federal-reserve?limit=2&page=1'
Python, standard library only
Python
import json
import os
import urllib.request

URL = "https://vg.tempproject.online/v1/site/topics/federal-reserve?limit=2&page=1"


def call() -> dict:
    req = urllib.request.Request(URL, headers={})
    with urllib.request.urlopen(req, timeout=15) as res:
        print(res.status, res.headers.get("ETag"))
        return json.loads(res.read().decode("utf-8"))


if __name__ == "__main__":
    body = call()
    print(json.dumps(body, indent=2, ensure_ascii=False)[:2000])
TypeScript, Node 18+, no dependencies
TypeScript
const res = await fetch(
  "https://vg.tempproject.online/v1/site/topics/federal-reserve?limit=2&page=1",
  {
    method: "GET",
    headers: {},
  },
);
if (!res.ok) throw new Error(`${res.status} ${await res.text()}`);
console.log(res.headers.get("etag"), await res.json());

The requests are generated from the path template and the parameters in clients/openapi.json, so a new parameter appears here without an edit to this site.

Example response

Response body
HTTP
cache-control: public, max-age=30, stale-while-revalidate=150, stale-if-error=300; no-store on 404
# validators: ETag, Last-Modified
content-type: application/octet-stream

No JSON body on this route; the headers are the ones docs/API.md §2 documents for it

Failures

This operation can answer 200, 304, 400, 404, 422, 429, 503. The full envelope for each status, with its body, is on Errors.