From ffed70ea4f9112e2d497aae679f47a8b85b3c6fe Mon Sep 17 00:00:00 2001 From: kzangeli Date: Sat, 19 Sep 2026 10:31:21 +0200 Subject: [PATCH 1/2] fix: a list of ids is not enough to make a query - add local=true Both "Filter Data Entities by ID" (13) and "Returning data as GeoJSON" (14) query /entities with `id` as the only selector. Clause 10.4.3.4 of the NGSI-LD API requires at least ONE of: a. a type selector b. a list of attribute names c. an NGSI-LD Query d. an NGSI-LD GeoQuery e. local scope and raises BadRequestData ("too wide query") if none is present. The clause says it in prose as well: "it is not possible to retrieve a set of entities by only specifying desired Entity identifiers, without further specifying restrictions on the entities' types or attributes". `pick` is not a selector - it chooses which members of an entity are returned, not which entities are - so neither request currently satisfies the rule. `local=true` is used here rather than `attrs`, for two reasons: it keeps the page's own point that `type` is not required when filtering by id, and `attrs` cannot be combined with `pick` (they are alternative projection mechanisms). Both amended requests were run against a broker and return exactly the responses the page documents. Co-Authored-By: Claude Opus 5 (1M context) --- README.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/README.md b/README.md index 8df77e5..2f63db6 100644 --- a/README.md +++ b/README.md @@ -870,6 +870,12 @@ parameter to retrieve key-values. This example lists selected data from two **TemperatureSensor** entities chosen by `id`. Note that every `id` must be unique, so `type` is not required for this request. To filter by `id` add the entries in a comma delimited list. +A list of `id` values is not on its own enough to make a query. NGSI-LD requires at least one of `type`, `attrs`, `q`, +a GeoQuery or `local=true`, and raises `BadRequestData` ("too wide query") without one - see clause 10.4.3.4 of the +NGSI-LD API specification. `pick` does not count: it selects which members of an entity are returned, not which +entities are. `local=true` is used here because it satisfies the requirement without naming a `type`, and `attrs` +cannot be combined with `pick`. + #### 1️⃣3️⃣ Request: ```console @@ -878,6 +884,7 @@ curl -G -iX GET \ -H 'Link: ; rel="http://www.w3.org/ns/json-ld#context"; type="application/ld+json"' \ -H 'Accept: application/json' \ -d 'id=urn:ngsi-ld:TemperatureSensor:001,urn:ngsi-ld:TemperatureSensor:002' \ +-d 'local=true' \ -d 'pick=id,type,temperature' \ -d 'format=concise' ``` @@ -921,6 +928,7 @@ curl -G -iX GET \ -H 'Accept: application/geo+json' \ -H 'NGSILD-Tenant: openiot' \ -d 'id=urn:ngsi-ld:Animal:pig010,urn:ngsi-ld:Animal:pig006' \ +-d 'local=true' \ -d 'format=concise' ``` From e16ab1b1ee34c823b25b25e1cd764bc1e86ded50 Mon Sep 17 00:00:00 2001 From: Jason Fox Date: Mon, 21 Sep 2026 08:59:22 +0200 Subject: [PATCH 2/2] Refine NGSI-LD query requirements in README Clarified the explanation about NGSI-LD query requirements and removed redundant information. --- README.md | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 2f63db6..e1982fe 100644 --- a/README.md +++ b/README.md @@ -871,10 +871,8 @@ This example lists selected data from two **TemperatureSensor** entities chosen unique, so `type` is not required for this request. To filter by `id` add the entries in a comma delimited list. A list of `id` values is not on its own enough to make a query. NGSI-LD requires at least one of `type`, `attrs`, `q`, -a GeoQuery or `local=true`, and raises `BadRequestData` ("too wide query") without one - see clause 10.4.3.4 of the -NGSI-LD API specification. `pick` does not count: it selects which members of an entity are returned, not which -entities are. `local=true` is used here because it satisfies the requirement without naming a `type`, and `attrs` -cannot be combined with `pick`. +a GeoQuery or `local=true`, and raises `BadRequestData` ("too wide query") without one, `pick` does not count, +so`local=true` is used here because it satisfies the requirement without naming a `type`. #### 1️⃣3️⃣ Request: