Cabinhub News API v1.0.0

Docs / Revoke Key

Revoke Key

Revoke Key

POST/v1/admin/keys/{key_id}/revoke
Auth
X-Admin-Token + X-Admin-Actor
Cache-Control
no-store
Source of truth
clients/openapi.json and docs/API.md §12

Revoke one key. Idempotent: the second call is a 200, not an error.

Description: clients/openapi.json

Parameters

NameInRequiredTypeExampleNotes
key_idpathyesinteger1
X-Admin-TokenheadernostringOperator token (NEWS_ADMIN_TOKEN). A client bearer is refused here.
X-Admin-Actorheadernostring

Example request

curl
Shell
curl -sS -X POST \
  'https://vg.tempproject.online/v1/admin/keys/1/revoke' \
  -H "X-Admin-Token: $NEWS_ADMIN_TOKEN" \
  -H "X-Admin-Actor: $NEWS_ADMIN_ACTOR"
Python, standard library only
Python
import json
import os
import urllib.request

URL = "https://vg.tempproject.online/v1/admin/keys/1/revoke"


def call() -> dict:
    req = urllib.request.Request(URL, method="POST", headers={
        "X-Admin-Token": os.environ["NEWS_ADMIN_TOKEN"],
        "X-Admin-Actor": os.environ["NEWS_ADMIN_ACTOR"],
    })
    with urllib.request.urlopen(req, timeout=15) as res:
        print(res.status, res.headers.get("Location"))
        text = res.read().decode("utf-8")
        return json.loads(text) if text else {}


if __name__ == "__main__":
    print(call())
TypeScript, Node 18+, no dependencies
TypeScript
const res = await fetch(
  "https://vg.tempproject.online/v1/admin/keys/1/revoke",
  {
    method: "POST",
    headers: {
      "x-admin-token": process.env.NEWS_ADMIN_TOKEN!,
      "x-admin-actor": process.env.NEWS_ADMIN_ACTOR!,
    },
  },
);
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: no-store
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, 400, 401, 404, 409, 422, 503. The full envelope for each status, with its body, is on Errors.