ApiReference
A whole endpoint from data: signature, parameters, request, response and errors, in that order. For pages made from an OpenAPI file.
import ApiReference from '@sypnia/ui/astro/ApiReference.astro'
On this page
One endpoint
List rows
GET
/v1/tables/{table}/rows The rows of a table, 20 at a time, newest first.
Parameters
-
limitintegeroptionalHow many rows, up to 100.Default:
20 -
cursorstringoptionalWhere to go on from.
Request
curl https://data.sypnia.com/v1/tables/orders/rows -H "Authorization: Bearer $SYPNIA_TOKEN" Response200
{ "rows": [{ "id": 1042 }], "next": "c_9f2" } Errors
- 404
table_not_foundThere is no table with that name.
Code
---
// A whole endpoint from data, as an OpenAPI file would give it.
import ApiReference from '@sypnia/ui/astro/ApiReference.astro';
const endpoint = {
method: 'GET', path: '/v1/tables/{table}/rows', title: 'List rows', id: 'list-rows', auth: 'API token (read)',
summary: 'The rows of a table, 20 at a time, newest first.',
params: [{ name: 'limit', type: 'integer', required: false, default: 20, text: 'How many rows, up to 100.' }, { name: 'cursor', type: 'string', required: false, text: 'Where to go on from.' }],
request: { code: 'curl https://data.sypnia.com/v1/tables/orders/rows -H "Authorization: Bearer $SYPNIA_TOKEN"' },
response: { status: 200, code: '{ "rows": [{ "id": 1042 }], "next": "c_9f2" }' },
errors: [{ code: 404, name: 'table_not_found', text: 'There is no table with that name.' }],
};
---
<div class="sy-docs" style="min-height:0;background:none"><ApiReference endpoint={endpoint} /></div> When to use it
Use it when
- Generated reference pages: one ApiReference per endpoint.
Do not use it when
- Hand-written pages: compose Endpoint, Params and the examples yourself.
For everyone
- Each endpoint gets a heading, so «On this page» lists them.