Ir al contenido

ApiReference

Un endpoint completo a partir de datos: firma, parámetros, solicitud, respuesta y errores, en ese orden. Para páginas hechas desde un archivo OpenAPI.

import ApiReference from '@sypnia/ui/astro/ApiReference.astro'

En esta página
  1. Un endpoint
  2. Cuándo usarlo
  3. Para todos

Un endpoint

List rows

GET /v1/tables/{table}/rows
The rows of a table, 20 at a time, newest first.
Autenticación
API token (read)

Parámetros

  • limit
    integeropcional
    How many rows, up to 100.

    Por defecto: 20

  • cursor
    stringopcional
    Where to go on from.

Solicitud

Shell
curl https://data.sypnia.com/v1/tables/orders/rows -H "Authorization: Bearer $SYPNIA_TOKEN"

Respuesta200

JSON
{ "rows": [{ "id": 1042 }], "next": "c_9f2" }

Errores

  • 404table_not_found
    There is no table with that name.
Código
---
// 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>

Cuándo usarlo

Úsalo cuando

  • Páginas de referencia generadas: un ApiReference por endpoint.

No lo uses cuando

  • Páginas escritas a mano: arma tú mismo Endpoint, Params y los ejemplos.

Para todos

  • Cada endpoint tiene un título, así aparece en «En esta página».
  1. Un endpoint
  2. Cuándo usarlo
  3. Para todos

    Busca páginas, secciones y términos