Skip to content

Commit 8a55fef

Browse files
authored
Filter by ID: a list of ids is not enough to make a query (steps 13 and 14) (#3)
* fix: a list of ids is not enough to make a query - add local=true
1 parent 02e328e commit 8a55fef

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

‎README.md‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -870,6 +870,10 @@ parameter to retrieve key-values.
870870
This example lists selected data from two **TemperatureSensor** entities chosen by `id`. Note that every `id` must be
871871
unique, so `type` is not required for this request. To filter by `id` add the entries in a comma delimited list.
872872

873+
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`,
874+
a GeoQuery or `local=true`, and raises `BadRequestData` ("too wide query") without one, `pick` does not count,
875+
so`local=true` is used here because it satisfies the requirement without naming a `type`.
876+
873877
#### 1️⃣3️⃣ Request:
874878

875879
```console
@@ -878,6 +882,7 @@ curl -G -iX GET \
878882
-H 'Link: <http://context/user-context.jsonld>; rel="http://www.w3.org/ns/json-ld#context"; type="application/ld+json"' \
879883
-H 'Accept: application/json' \
880884
-d 'id=urn:ngsi-ld:TemperatureSensor:001,urn:ngsi-ld:TemperatureSensor:002' \
885+
-d 'local=true' \
881886
-d 'pick=id,type,temperature' \
882887
-d 'format=concise'
883888
```
@@ -921,6 +926,7 @@ curl -G -iX GET \
921926
-H 'Accept: application/geo+json' \
922927
-H 'NGSILD-Tenant: openiot' \
923928
-d 'id=urn:ngsi-ld:Animal:pig010,urn:ngsi-ld:Animal:pig006' \
929+
-d 'local=true' \
924930
-d 'format=concise'
925931
```
926932

0 commit comments

Comments
 (0)