RequestExample
The example request of an endpoint: a title over the code that shows it.
import RequestExample from '@sypnia/ui/astro/RequestExample.astro'
A request and its response
Request
curl https://data.sypnia.com/v1/tables/orders/rows?limit=2 \
-H "Authorization: Bearer $SYPNIA_TOKEN" Response200
{
"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.