Accessibility Widget: Shop API / Headless
Accessibility widget for Sylius - Shop API endpoint for headless storefronts, request/response example, error format
Accessibility Widget: Shop API / Headless
Live Demo: Try this and other plugins live — no installation, no risk: demo.markus-michalski.net
The plugin is dual-mode: the same channel settings the Twig storefront renders are also readable through the Shop API. The resource is read-only and has this one operation only.
Endpoint
| Method | Path | Description |
|---|---|---|
GET |
/api/v2/shop/accessibility-settings |
Settings of the channel the request resolves to |
The channel is determined through the Sylius channel context, as in the storefront (for example by the request host); you do not pass a channel code.
Request
curl https://shop.example.com/api/v2/shop/accessibility-settings
Response
{
"channelCode": "diy",
"position": "bottom_right",
"skipLink": true,
"options": {
"fontSize": true,
"contrast": true,
"colorFilter": true,
"blueLight": true,
"animations": true
}
}
The example shows only the plugin's own fields. The default response of the Sylius API (JSON-LD) additionally carries the Hydra keys @context, @id and @type.
| Field | Meaning |
|---|---|
channelCode |
Code of the resolved channel |
position |
bottom_right or bottom_left |
skipLink |
Whether the skip link is switched on |
options.fontSize |
Font size tool |
options.contrast |
Contrast tool |
options.colorFilter |
Colour filter tool |
options.blueLight |
Blue light filter tool |
options.animations |
Reduce animations tool |
Error format
| Status | When |
|---|---|
404 |
The channel cannot be resolved, has no row, the row is disabled or the settings cannot be read - the same "show nothing" answer as the storefront |
A headless storefront renders its own widget from this response; the CSS classes from Storefront Integration are only a convention, not a requirement.