Skip to content

Commit

Permalink
Explicitly add apiKey
Browse files Browse the repository at this point in the history
  • Loading branch information
jason-fox committed Jul 1, 2024
1 parent 7e9dd70 commit 197adee
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 32 deletions.
37 changes: 21 additions & 16 deletions docs/iot-agent-json.md
Original file line number Diff line number Diff line change
Expand Up @@ -521,6 +521,7 @@ curl -L -X POST 'http://localhost:4041/iot/devices' \
"device_id": "temperature001",
"entity_name": "urn:ngsi-ld:Device:temperature001",
"entity_type": "Device",
"apikey": "4jggokgpepnvsb2uv4s40d59ov",
"timezone": "Europe/Berlin",
"attributes": [
{
Expand Down Expand Up @@ -605,7 +606,7 @@ curl -G -iX GET 'http://localhost:1026/ngsi-ld/v1/entities/urn:ngsi-ld:Device:te
-H 'NGSILD-Tenant: openiot' \
-H 'NGSILD-Path: /' \
-H 'Accept: application/ld+json' \
-H 'Link: <http://context/ngsi-context.jsonld>; rel="http://www.w3.org/ns/json-ld#context"; type="application/ld+json"' \
-H 'Link: <http://context/user-context.jsonld>; rel="http://www.w3.org/ns/json-ld#context"; type="application/ld+json"' \
-d 'attrs=temperature'
```

Expand All @@ -620,7 +621,10 @@ curl -G -iX GET 'http://localhost:1026/ngsi-ld/v1/entities/urn:ngsi-ld:Device:te

```json
{
"@context": "http://context/ngsi-context.jsonld",
"@context": [
"http://context/ngsi-context.jsonld",
"https://uri.etsi.org/ngsi-ld/v1/ngsi-ld-core-context-v1.7.jsonld"
],
"id": "urn:ngsi-ld:Device:temperature001",
"type": "Device",
"temperature": {
Expand Down Expand Up @@ -664,15 +668,18 @@ curl -L -X GET 'http://localhost:1026/ngsi-ld/v1/entities/?type=Device' \
-H 'NGSILD-Tenant: openiot' \
-H 'NGSILD-Path: /' \
-H 'Accept: application/ld+json' \
-H 'Link: <http://context/ngsi-context.jsonld>; rel="http://www.w3.org/ns/json-ld#context"; type="application/ld+json"'
-H 'Link: <http://context/user-context.jsonld>; rel="http://www.w3.org/ns/json-ld#context"; type="application/ld+json"'
```

#### Response:

```json
[
{
"@context": "http://context/ngsi-context.jsonld",
"@context": [
"http://context/ngsi-context.jsonld",
"https://uri.etsi.org/ngsi-ld/v1/ngsi-ld-core-context-v1.7.jsonld"
],
"id": "urn:ngsi-ld:Device:motion003",
"type": "Device",
"c": {
Expand Down Expand Up @@ -719,6 +726,7 @@ curl -L -X POST 'http://localhost:4041/iot/devices' \
"device_id": "water001",
"entity_name": "urn:ngsi-ld:Device:water001",
"entity_type": "Device",
"apikey": "4jggokgpepnvsb2uv4s40d59ov",
"protocol": "PDI-IoTA-UltraLight",
"transport": "HTTP",
"endpoint": "http://iot-sensors:3001/iot/water001",
Expand Down Expand Up @@ -772,7 +780,7 @@ The result of the command to turn on the irrigation system can be read by queryi
```bash
curl -L -X GET 'http://localhost:1026/ngsi-ld/v1/entities/urn:ngsi-ld:Device:water001' \
-H 'NGSILD-Tenant: openiot' \
-H 'Link: <http://context/ngsi-context.jsonld>; rel="http://www.w3.org/ns/json-ld#context"; type="application/ld+json"' \
-H 'Link: <http://context/user-context.jsonld>; rel="http://www.w3.org/ns/json-ld#context"; type="application/ld+json"' \
-H 'Accept: application/json'
```

Expand Down Expand Up @@ -802,14 +810,6 @@ curl -L -X GET 'http://localhost:1026/ngsi-ld/v1/entities/urn:ngsi-ld:Device:wat
"type": "Relationship",
"object": "urn:ngsi-ld:Building:barn001",
"observedAt": "2020-09-14T15:27:11.066Z"
},
"on": {
"type": "Property",
"value": ""
},
"off": {
"type": "Property",
"value": ""
}
}
```
Expand All @@ -835,6 +835,7 @@ curl -L -X POST 'http://localhost:4041/iot/devices' \
"device_id": "filling001",
"entity_name": "urn:ngsi-ld:Device:filling001",
"entity_type": "FillingLevelSensor",
"apikey": "4jggokgpepnvsb2uv4s40d59ov",
"protocol": "PDI-IoTA-UltraLight",
"transport": "HTTP",
"endpoint": "http://iot-sensors:3001/iot/filling001",
Expand Down Expand Up @@ -890,6 +891,7 @@ curl -L -X POST 'http://localhost:4041/iot/devices' \
"device_id": "tractor001",
"entity_name": "urn:ngsi-ld:Device:tractor001",
"entity_type": "Tractor",
"apikey": "4jggokgpepnvsb2uv4s40d59ov",
"protocol": "PDI-IoTA-UltraLight",
"transport": "HTTP",
"endpoint": "http://iot-sensors:3001/iot/tractor001",
Expand Down Expand Up @@ -939,7 +941,7 @@ To invoke the `on` command, the `on` attribute must be updated in the context.
curl -L -X PATCH 'http://localhost:1026/ngsi-ld/v1/entities/urn:ngsi-ld:Device:water001/attrs/on' \
-H 'NGSILD-Tenant: openiot' \
-H 'Content-Type: application/json' \
-H 'Link: <http://context/ngsi-context.jsonld>; rel="http://www.w3.org/ns/json-ld#context"; type="application/ld+json"' \
-H 'Link: <http://context/user-context.jsonld>; rel="http://www.w3.org/ns/json-ld#context"; type="application/ld+json"' \
--data-raw '{
"type": "Property",
Expand All @@ -962,7 +964,7 @@ To invoke the `start` command, the `start` attribute must be updated in the cont
curl -L -X PATCH 'http://localhost:1026/ngsi-ld/v1/entities/urn:ngsi-ld:Device:tractor001/attrs/start' \
-H 'NGSILD-Tenant: openiot' \
-H 'Content-Type: application/json' \
-H 'Link: <http://context/ngsi-context.jsonld>; rel="http://www.w3.org/ns/json-ld#context"; type="application/ld+json"' \
-H 'Link: <http://context/user-context.jsonld>; rel="http://www.w3.org/ns/json-ld#context"; type="application/ld+json"' \
--data-raw '{
"type": "Property",
Expand All @@ -981,7 +983,7 @@ Change the state of the **Filling System**, the `add` attribute must be updated
curl -L -X PATCH 'http://localhost:1026/ngsi-ld/v1/entities/urn:ngsi-ld:Device:filling001/attrs/add' \
-H 'NGSILD-Tenant: openiot' \
-H 'Content-Type: application/json' \
-H 'Link: <http://context/ngsi-context.jsonld>; rel="http://www.w3.org/ns/json-ld#context"; type="application/ld+json"' \
-H 'Link: <http://context/user-context.jsonld>; rel="http://www.w3.org/ns/json-ld#context"; type="application/ld+json"' \
--data-raw '{
"type": "Property",
Expand Down Expand Up @@ -1225,6 +1227,7 @@ curl -iX POST 'http://localhost:4041/iot/devices' \
"device_id": "water002",
"entity_name": "urn:ngsi-ld:Device:water002",
"entity_type": "Device",
"apikey": "4jggokgpepnvsb2uv4s40d59ov",
"protocol": "PDI-IoTA-UltraLight",
"transport": "HTTP",
"endpoint": "http://iot-sensors:3001/iot/water002",
Expand Down Expand Up @@ -1273,6 +1276,7 @@ The response includes all the commands and attributes mappings associated with t
"service_path": "/",
"entity_name": "urn:ngsi-ld:Device:water002",
"entity_type": "Device",
"apikey": "4jggokgpepnvsb2uv4s40d59ov",
"endpoint": "http://iot-sensors:3001/iot/water002",
"transport": "HTTP",
"attributes": [],
Expand Down Expand Up @@ -1328,6 +1332,7 @@ The response includes all the commands and attributes mappings associated with a
"service_path": "/",
"entity_name": "urn:ngsi",
"entity_type": "Device",
"apikey": "4jggokgpepnvsb2uv4s40d59ov",
"endpoint": "http://iot-sensors:3001/iot/water002",
"transport": "HTTP",
"attributes": [],
Expand Down
30 changes: 14 additions & 16 deletions docs/iot-agent.md
Original file line number Diff line number Diff line change
Expand Up @@ -600,7 +600,7 @@ curl -G -iX GET 'http://localhost:1026/ngsi-ld/v1/entities/urn:ngsi-ld:Device:te
-H 'NGSILD-Tenant: openiot' \
-H 'NGSILD-Path: /' \
-H 'Accept: application/ld+json' \
-H 'Link: <http://context/ngsi-context.jsonld>; rel="http://www.w3.org/ns/json-ld#context"; type="application/ld+json"' \
-H 'Link: <http://context/user-context.jsonld>; rel="http://www.w3.org/ns/json-ld#context"; type="application/ld+json"' \
-d 'attrs=temperature'
```

Expand All @@ -615,7 +615,10 @@ curl -G -iX GET 'http://localhost:1026/ngsi-ld/v1/entities/urn:ngsi-ld:Device:te

```json
{
"@context": "http://context/ngsi-context.jsonld",
"@context": [
"http://context/ngsi-context.jsonld",
"https://uri.etsi.org/ngsi-ld/v1/ngsi-ld-core-context-v1.7.jsonld"
],
"id": "urn:ngsi-ld:Device:temperature001",
"type": "Device",
"temperature": {
Expand Down Expand Up @@ -659,15 +662,18 @@ curl -L -X GET 'http://localhost:1026/ngsi-ld/v1/entities/?type=Device' \
-H 'NGSILD-Tenant: openiot' \
-H 'NGSILD-Path: /' \
-H 'Accept: application/ld+json' \
-H 'Link: <http://context/ngsi-context.jsonld>; rel="http://www.w3.org/ns/json-ld#context"; type="application/ld+json"'
-H 'Link: <http://context/user-context.jsonld>; rel="http://www.w3.org/ns/json-ld#context"; type="application/ld+json"'
```

#### Response:

```json
[
{
"@context": "http://context/ngsi-context.jsonld",
"@context": [
"http://context/ngsi-context.jsonld",
"https://uri.etsi.org/ngsi-ld/v1/ngsi-ld-core-context-v1.7.jsonld"
],
"id": "urn:ngsi-ld:Device:motion003",
"type": "Device",
"c": {
Expand Down Expand Up @@ -767,7 +773,7 @@ The result of the command to turn on the irrigation system can be read by queryi
```bash
curl -L -X GET 'http://localhost:1026/ngsi-ld/v1/entities/urn:ngsi-ld:Device:water001' \
-H 'NGSILD-Tenant: openiot' \
-H 'Link: <http://context/ngsi-context.jsonld>; rel="http://www.w3.org/ns/json-ld#context"; type="application/ld+json"' \
-H 'Link: <http://context/user-context.jsonld>; rel="http://www.w3.org/ns/json-ld#context"; type="application/ld+json"' \
-H 'Accept: application/json'
```

Expand Down Expand Up @@ -828,14 +834,6 @@ curl -L -X GET 'http://localhost:1026/ngsi-ld/v1/entities/urn:ngsi-ld:Device:wat
"@type": "commandResult",
"@value": " "
}
},
"on": {
"type": "Property",
"value": ""
},
"off": {
"type": "Property",
"value": ""
}
}
```
Expand Down Expand Up @@ -967,7 +965,7 @@ To invoke the `on` command, the `on` attribute must be updated in the context.
curl -L -X PATCH 'http://localhost:1026/ngsi-ld/v1/entities/urn:ngsi-ld:Device:water001/attrs/on' \
-H 'NGSILD-Tenant: openiot' \
-H 'Content-Type: application/json' \
-H 'Link: <http://context/ngsi-context.jsonld>; rel="http://www.w3.org/ns/json-ld#context"; type="application/ld+json"' \
-H 'Link: <http://context/user-context.jsonld>; rel="http://www.w3.org/ns/json-ld#context"; type="application/ld+json"' \
--data-raw '{
"type": "Property",
Expand All @@ -990,7 +988,7 @@ To invoke the `start` command, the `start` attribute must be updated in the cont
curl -L -X PATCH 'http://localhost:1026/ngsi-ld/v1/entities/urn:ngsi-ld:Device:tractor001/attrs/start' \
-H 'NGSILD-Tenant: openiot' \
-H 'Content-Type: application/json' \
-H 'Link: <http://context/ngsi-context.jsonld>; rel="http://www.w3.org/ns/json-ld#context"; type="application/ld+json"' \
-H 'Link: <http://context/user-context.jsonld>; rel="http://www.w3.org/ns/json-ld#context"; type="application/ld+json"' \
--data-raw '{
"type": "Property",
Expand All @@ -1009,7 +1007,7 @@ Change the state of the **Filling System**, the `add` attribute must be updated
curl -L -X PATCH 'http://localhost:1026/ngsi-ld/v1/entities/urn:ngsi-ld:Device:filling001/attrs/add' \
-H 'NGSILD-Tenant: openiot' \
-H 'Content-Type: application/json' \
-H 'Link: <http://context/ngsi-context.jsonld>; rel="http://www.w3.org/ns/json-ld#context"; type="application/ld+json"' \
-H 'Link: <http://context/user-context.jsonld>; rel="http://www.w3.org/ns/json-ld#context"; type="application/ld+json"' \
--data-raw '{
"type": "Property",
Expand Down

0 comments on commit 197adee

Please sign in to comment.