4.5 KiB
MODIFIED Requirements
Requirement: Base path and resource naming
Edition: CE. Every dashboard API route SHALL live under /api/v1, use lower-case plural nouns for resources
(rooms, participants, agents, tracks, egresses, ingresses, analytics, overview, status, auth,
info), nest
sub-resources at most one level under the parent identifier, and answer every unknown /api path with a JSON
404 instead of the SPA fallback.
Scenario: Sub-resource path
- GIVEN a room with SID
RM_abc - WHEN the client requests its participants
- THEN the path is
GET /api/v1/rooms/RM_abc/participants
Scenario: Unknown API path
- WHEN the client requests
GET /api/v1/does-not-existorGET /api/anything - THEN the response is
404with body{ error: { code: 'NOT_FOUND', message } }andContent-Type: application/json, never the SPAindex.html, and the message names the full path, such asNo API route for GET /api/v1/does-not-exist
ADDED Requirements
Requirement: OpenAPI document metadata
Edition: CE. The OpenAPI document SHALL carry the following:
- an
info.descriptionof the API conventions; info.license: Apache 2.0 unless the edition provides another;- one
serversentry with the dashboard's public base path; - a
tagslist with a description per tag, holding only the tags of the listed operations.
Scenario: Behind a base path
- GIVEN the server runs with
DASHBOARD_BASE_PATH=/dashboard/andNODE_ENV=development - WHEN the client reads the document
- THEN
servers[0].urlis/dashboard, and the paths start with/api/v1
Scenario: Conventions described
- WHEN the client reads
info.description - THEN it explains the following:
- the bearer access token and the refresh cookie;
- the
from,toandtztime expressions; - cursor pagination with
limitandtotal; - the
ApiErrorenvelope; ETagandIf-None-Match;- the
X-Request-Idheader; - the versioning policy.
Scenario: Tags
- WHEN the client reads
tags - THEN every operation's tags are listed there with a description, and no listed tag lacks an operation
Requirement: OpenAPI operations
Edition: CE. Every operation of the OpenAPI document SHALL have the following:
- a unique
operationId, a summary and tags; - a description for every parameter, with comma-separated list parameters as arrays of their allowed values
(
style: form,explode: false); - an
If-None-Matchheader parameter when it can answer304; - on the auth routes, the refresh cookie as a cookie security scheme, and the
Set-Cookieheader of the responses that set or clear it.
Scenario: Operation identifiers
- WHEN the client reads every operation of the document
- THEN each has an
operationIdthat no other operation shares, such aslistRoomsforGET /api/v1/rooms
Scenario: List parameter
- WHEN the client reads the
kindparameter ofGET /api/v1/participants - THEN it has a description,
style: form,explode: false, and an array schema whose items enumerate the participant kinds
Scenario: Conditional request
- WHEN the client reads
GET /api/v1/overview - THEN it declares the
If-None-Matchheader parameter, theETagheader of its200, and its304
Scenario: Refresh cookie
- WHEN the client reads
POST /api/v1/auth/refresh - THEN its security names the refresh cookie scheme (
in: cookie,name: ov_dashboard_refresh), and its200and401declareSet-Cookie
Requirement: OpenAPI error responses
Edition: CE. Every error response an operation can answer SHALL be declared with the ApiError schema. This means
400 only for operations that take parameters or a body, 401 for operations that need or accept a token, and the
route's own errors such as 404, 429 and 503. A response that only one edition answers SHALL appear only in that
edition's document.
Scenario: Operation without input
- WHEN the client reads
GET /api/v1/health - THEN it declares no
400
Scenario: Error body
- WHEN the client reads the
429ofPOST /api/v1/auth/login - THEN its content is
application/jsonwith theApiErrorschema
Scenario: Edition-specific error
- WHEN the client reads
GET /api/v1/analytics/seriesin the CE document - THEN it declares the
403of a PRO metric, dimension or node scope; and no CE operation declares a403PRO_FEATUREfor being a PRO route