Skip to content

RequestExample

The example request of an endpoint: a title over the code that shows it.

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

On this page
  1. A request and its response
  2. When to use it
  3. For everyone

A request and its response

Request

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

Response200

JSON
{
  "rows": [{ "id": 1042, "total": 38.5 }, { "id": 1041, "total": 12 }],
  "next": "c_9f2"
}
Code
---
import RequestExample from '@sypnia/ui/astro/RequestExample.astro';
import ResponseExample from '@sypnia/ui/astro/ResponseExample.astro';
import CodeBlock from '@sypnia/ui/astro/CodeBlock.astro';
---
<div class="sy-docs" style="min-height:0;background:none">
  <RequestExample><CodeBlock lang="sh" code={`curl https://data.sypnia.com/v1/tables/orders/rows?limit=2 \\\n  -H "Authorization: Bearer $SYPNIA_TOKEN"`} /></RequestExample>
  <ResponseExample status={200}><CodeBlock lang="json" code={`{\n  "rows": [{ "id": 1042, "total": 38.5 }, { "id": 1041, "total": 12 }],\n  "next": "c_9f2"\n}`} /></ResponseExample>
</div>

When to use it

Use it when

  • Right after Params, on an endpoint's page.

Do not use it when

  • General code samples: a CodeBlock alone.

For everyone

  • The title says what the code is.
  1. A request and its response
  2. When to use it
  3. For everyone

    Search pages, sections and terms