Alpha: Ships on npm at 7.0.0-alpha.07.0.0-alpha.0

api-call

One API call beside its answer, a JSON response or an event stream.

View as JSON

Carried by the api-product Template. Seen on pages/harbor/home.json, section 4.

From Harbor tides › homequaypointOpen the frame
pages/harbor/home.json, section 4
{
  "kind": "section",
  "shell": { "inset": "contained", "density": "section", "surface": "plate" },
  "block": {
    "type": "api-call",
    "method": "GET",
    "path": "/v1/berths/{berth}/tides",
    "note": "One berth, 14 days",
    "examples": [
      {
        "label": "Pier 4, today",
        "request": "curl https://api.harbor-tides.example/v1/berths/pier-4/tides?days=1",
        "status": "200 OK",
        "response": "{\n  \"berth\": \"pier-4\",\n  \"datum\": \"chart datum\",\n  \"tides\": [\n    { \"at\": \"04:12\", \"type\": \"low\", \"m\": 0.6 },\n    { \"at\": \"10:31\", \"type\": \"high\", \"m\": 4.1 },\n    { \"at\": \"16:40\", \"type\": \"low\", \"m\": 0.8 },\n    { \"at\": \"22:58\", \"type\": \"high\", \"m\": 3.9 }\n  ]\n}"
      }
    ]
  }
}

Smallest that parses

{
  "type": "api-call",
  "method": "GET",
  "path": "/v1/berths/{berth}/tides",
  "examples": [
    {
      "label": "Pier 4, today",
      "request": "curl https://api.harbor-tides.example/v1/berths/pier-4/tides?days=1",
      "status": "200 OK",
      "response": "{\n  \"berth\": \"pier-4\",\n  \"datum\": \"chart datum\",\n  \"tides\": [\n    { \"at\": \"04:12\", \"type\": \"low\", \"m\": 0.6 },\n    { \"at\": \"10:31\", \"type\": \"high\", \"m\": 4.1 },\n    { \"at\": \"16:40\", \"type\": \"low\", \"m\": 0.8 },\n    { \"at\": \"22:58\", \"type\": \"high\", \"m\": 3.9 }\n  ]\n}"
    }
  ]
}

Props

From @mdxui/site@7.0.0-alpha.0. A count reads as min–max × item; a string bound is its maximum length in characters, and links its refusal.

PropType and boundRequired
method"GET" | "POST" | "PUT" | "PATCH" | "DELETE"yes
pathstring ≤72yes
notestring ≤32no
groupstring (pattern)no
examples1–4 × objectyes
examples[].labelstring ≤28yes
examples[].requeststring ≤1008yes
examples[].statusstring ≤28yes
examples[].responsestring ≤1728no
examples[].events1–10 × objectno
examples[].events[].atstring ≤12yes
examples[].events[].namestring ≤40yes
examples[].events[].refstring ≤16no
examples[].events[].textstring ≤80yes
examples[].events[].openbooleanno

Use instead