Repository navigation
Description
Summary
The library's URL builder (CSAPIQueryBuilder) currently constructs detail URLs like /procedures/{id} and relies on the HTTP Accept header for content negotiation (e.g., Accept: application/sml+json to request SensorML). However, several real-world OGC API servers — notably OpenSensorHub (OSH) — ignore the Accept header and require a ?f= query parameter for format selection instead.
This means the library cannot request alternate representations (SensorML, HTML, etc.) from servers that only support query-parameter-based negotiation without the consumer manually appending ?f=... to the URL — defeating the purpose of the URL builder.
Observed Behavior
Server: OpenSensorHub at http://45.55.99.236:8080/sensorhub/api
Request:
GET /sensorhub/api/procedures/040g
Accept: application/sml+json, application/jsonExpected Response: SensorML JSON (application/sml+json)
Actual Response: GeoJSON Feature (application/json) — the server ignores the Accept header entirely.
The server's response does include an alternate link pointing to the SensorML representation:
{
\"rel\": \"alternate\",
\"title\": \"This procedure resource in SensorML format\",
\"href\": \"http://45.55.99.236:8080/sensorhub/api/procedures/040g?f=sml3\",
\"type\": \"application/sml+json\"
}This confirms the server supports SensorML — it just requires ?f=sml3 instead of Accept header negotiation.
Affected Endpoints
This applies to any resource that has multiple representations. Known cases:
| Resource | Format | Accept Header | Query Parameter |
|---|---|---|---|
| Procedures | SensorML 3.0 | application/sml+json |
?f=sml3 |
| Procedures | HTML | text/html |
?f=html |
| Systems | SensorML 3.0 | application/sml+json |
?f=sml3 |
| Any resource | GeoJSON | application/geo+json |
?f=json |
The specific ?f= token values are server-dependent (OSH uses sml3, other servers may use sml+json or sensorml).
Proposed Solution
Add an optional format (or f) parameter to the URL builder's detail and list methods, so consumers can request alternate representations via query parameter when the server doesn't honor Accept headers.
Option A: Add format to existing query options
interface QueryOptions {
limit?: number;
offset?: number;
format?: string; // ← NEW: appended as ?f={value}
// ...
}
// Usage:
builder.getProcedure(id, { format: 'sml3' })
// → /procedures/040g?f=sml3Note: This option depends on #100 being resolved first — currently,
getProcedure(id)callsassertResourceAvailable('procedures'), which throws if the resource wasn't discovered as a top-level link, before any query options are even processed.
Option B: Add a dedicated format method
builder.getProcedure(id).withFormat('sml3')
// → /procedures/040g?f=sml3Option C: Support both Accept header AND ?f= parameter
A higher-level approach where the library's fetch layer tries Accept first, and if the response content type doesn't match, checks for an alternate link and follows it — similar to the workaround implemented in the CSAPI Explorer demo's SensorMLDisplay.vue component (commit ff8b1c5).
OGC API Specification Context
The OGC API — Common Part 1 specification supports both content negotiation mechanisms:
- §7.7 (HTTP Content Negotiation): Servers SHOULD support
Acceptheaders - §7.8 (Parameter-based Negotiation): Servers MAY support a
fquery parameter as an alternative
Both are valid per the spec, but the library currently only facilitates the Accept header path. Supporting the ?f= parameter would make the library work correctly with a broader range of compliant servers.
Cross-Server Findings
| Server | Accept Header Honored? |
?f= Parameter Supported? |
|---|---|---|
| OpenSensorHub (OSH) | ❌ No | ✅ Yes (?f=sml3) |
| 52North CSAPI Demo | ✅ Yes |
Current Workaround
In the CSAPI Explorer demo app, SensorMLDisplay.vue works around this by:
- Sending
Accept: application/sml+json - If the response is GeoJSON (not SensorML), scanning
response.links[]for an alternate link withtype: \"application/sml+json\" - Following that alternate link (which contains the
?f=sml3parameter)
This works but forces every consumer to implement their own fallback logic. The URL builder should make this unnecessary.
Interaction with #100
This issue is compounded by #100 (assertResourceAvailable() is overly strict for per-ID methods). Even if format were added to QueryOptions, calling builder.getProcedure(id, { format: 'sml3' }) would still throw on OSH because procedures may not be in availableResources — the assertion fires before the URL (including the ?f= parameter) is ever constructed. Both issues need to be resolved for the URL builder to work reliably with real-world servers.
References
- OGC API — Common Part 1, §7.7–7.8: Content negotiation mechanisms
- OGC API — Connected Systems Part 1, §7.3: Procedure resource representations
- Demo workaround:
demo/src/components/SensorMLDisplay.vue(commitff8b1c5) - Discovered during: OS4CSAPI/ogc-csapi-explorer#27
- Related: [SPLIT] assertResourceAvailable() overly strict for per-ID methods → #156 + #157 #100 (
assertResourceAvailable()blocks per-ID URL construction)"
Activity
docs: add Issue #99 findings report — ?f= parameter already supported
Sam-Bolling commentedon Feb 21, 2026
Closing as not planned — the requested capability already exists.
QueryOptions.f?: MimeTypeis already defined inmodel.ts(L138), andbuildQueryString()already serializes it to?f={value}. Consumers can pass{ f: 'sml3' }to any per-ID method (e.g.,builder.getProcedure('040g', { f: 'sml3' })) to get query-parameter-based format negotiation today.The demo app's workaround was unnecessary for Part 1 resources. The actual blocker for Part 2 resources is #100 (
assertResourceAvailable()throwing before URL construction), which is a separate concern.Full findings report:
docs/testing/demo-app-findings/issue-99-format-query-parameter.mddocs: add Phase 5.5 code review (Issues #99-#110 post-smoke-test)
research(phase-9): reframe doc with #188 as input to existing research