Concorde reference — API configuration. APIConfiguration is the object built by HTML.getApiConfiguration from ancestor attributes on the DOM (or from a typed publisher — see @get / @post configuration key). It is passed to API by fetchers, Doc ID: docs/_misc/api-configuration. Keywords: Concorde, supersoniks, docs/_misc/api-configuration, api-configuration, API configuration, reference, APIConfiguration, HTML.getApiConfiguration, API, wording(), @get, @post, @put, @patch, serviceURL. URL: https://concorde.supersoniks.org/crawl/docs/_misc/api-configuration.html.
API configuration
APIConfiguration is the object built by HTML.getApiConfiguration from ancestor attributes on the DOM (or from a typed publisher — see @get / @post configuration key). It is passed to API by fetchers, sonic-submit, the wording() directive, @get, @post, @put, and @patch.
Mock service: same Local API demos Service Worker / Vite middleware. Routes used on this page are listed in the API config routes section below.
Attribute map
| Attribute (ancestor) | APIConfiguration field |
Role |
|---|---|---|
serviceURL |
serviceURL |
Base URL (e.g. /docs-mock-api) |
token |
token |
Static Bearer sent on REST calls |
userName / password |
userName / password |
Basic auth for tokenProvider fetch only |
eventsApiToken |
authToken |
Bearer for tokenProvider when no Basic |
tokenProvider |
tokenProvider |
Path to GET a new token ({ token } JSON) |
wordingProvider |
— (read by wording()) |
Base path + query for label batch GET |
wordingVersionProvider |
— | Publisher id; bump version → reload wordings |
credentials |
credentials |
fetch credentials mode |
addHTTPResponse |
addHTTPResponse |
Attach _sonic_http_response_ on result |
cache |
cache |
fetch cache mode |
blockUntilDone |
blockUntilDone |
Serialize calls per serviceURL |
keepAlive |
keepAlive |
fetch keepalive |
Lit / TypeScript: store the same shape in a publisher and pass DataProviderKey<APIConfiguration> as the second argument of @get (see DataProviderKey).
Bearer token (static)
Publisher docsApiConfBearerKey (set(docsApiConfBearerKey, { token: "docs-mock-valid-token", … })) — mock returns the protected payload.
tokenProvider + Basic auth
No static token: API.auth() calls GET /docs-mock-api/auth/token with Basic demo / secret, stores token, then calls the protected route.
HTTP 498 — stale token refresh
Initial token="docs-mock-stale-token" → mock responds 498 → Concorde invalidates the token, runs auth() again (same tokenProvider + Basic), retries with docs-mock-fresh-token.
eventsApiToken
Attribute eventsApiToken on an ancestor maps to authToken in config (used as Bearer when calling tokenProvider, instead of Basic).
Wording API
wordingProvider="wording/labels?lang=fr" + wording('api-config.greeting') in Lit. Mock returns label map from labels[] query params.
Scoped attributes (HTML / sonic-scope)
Attributes on sonic-scope (or any ancestor) are visible to descendants via getAncestorAttributeValue.
API config routes
| Route | Demo |
|---|---|
GET /docs-mock-api/auth/token |
tokenProvider, eventsApiToken |
GET /docs-mock-api/api/config/protected |
Bearer / Basic / 498 |
GET /docs-mock-api/wording/labels?labels[]=…&lang=fr |
wording() |
Mock tokens (doc only): docs-mock-valid-token, docs-mock-stale-token (498), docs-mock-fresh-token (after refresh). Basic: demo / secret. Events token: docs-mock-events-token.
Implementation: src/docs/mock-api/api-config-mock.ts (bundled in the Service Worker with router.ts).