Commit d7c95bb3 authored by Federico Sismondi's avatar Federico Sismondi

Migration of all API calls to LD queries

parent 0d0d8f1f
......@@ -11,7 +11,7 @@ before using `security` scripts.
- For a more complete explanation of the scripts included here please refer to the
[oficial tutorial](https://fiware-orion.readthedocs.io/en/master/user/walkthrough_apiv2/index.html)
[nsgi-ld tutorial](https://fiware-datamodels.readthedocs.io/en/latest/ngsi-ld_howto/index.html)
- For those scripts related to security (authentication and authorization),
please refer to the [FIWARE-IDM documentation](https://fiware-idm.readthedocs.io/en/7.4.0/api/)
......
......@@ -4,8 +4,7 @@
echo "Querying context broker at: ${ORION_HOST}"
curl --location --request GET \
"http://$ORION_HOST:1026/v2/subscriptions/" \
"http://$ORION_HOST:1026/ngsi-ld/v1/subscriptions/" \
--header "Fiware-Service: carouge" \
--header "Fiware-ServicePath: /watering" \
| python -mjson.tool
......@@ -4,9 +4,8 @@
echo "Querying context broker at: ${ORION_HOST}"
curl -iX POST \
"http://$ORION_HOST:1026/v2/entities/" \
"http://$ORION_HOST:1026/ngsi-ld/v1/entities/" \
--header "Fiware-Service: carouge" \
--header "Fiware-ServicePath: /watering" \
--header "Content-Type: application/json" \
--data '{
"id": "urn:ngsi-ld:FlowerBed:FlowerBed-345",
......
......@@ -4,7 +4,6 @@
echo "Querying context broker at: ${ORION_HOST}"
curl --location --request GET \
"http://$ORION_HOST:1026/v2/entities/" \
"http://$ORION_HOST:1026/ngsi-ld/v1/entities?type=FlowerBed" \
--header "Fiware-Service: carouge" \
--header "Fiware-ServicePath: /watering" \
| python -mjson.tool
......@@ -4,7 +4,6 @@
echo "Querying context broker at: ${ORION_HOST}"
curl --location --request GET \
"http://$ORION_HOST:1026/v2/entities/urn:ngsi-ld:FlowerBed:FlowerBed-345?options=keyValues" \
"http://$ORION_HOST:1026/ngsi-ld/v1/entities/urn:ngsi-ld:FlowerBed:FlowerBed-345?options=keyValues" \
--header "Fiware-Service: carouge" \
--header "Fiware-ServicePath: /watering" \
| python -mjson.tool
\ No newline at end of file
| python -mjson.tool
#!/usr/bin/env bash
[[ -z "$ORION_HOST" ]] && echo "Please set ORION_HOST env var. E.g. export ORION_HOST=127.0.0.1" && exit
echo "Querying context broker at: ${ORION_HOST}"
curl --location --request GET \
"http://$ORION_HOST:1026/v2/entities/urn:ngsi-ld:FlowerBed:FlowerBed-345/attrs/soilMoistureVwc/value" \
--header "Fiware-Service: carouge" \
--header "Fiware-ServicePath: /watering" \
| python -mjson.tool
#curl --location --request GET \
# "http://$ORION_HOST:1026/v2/entities/urn:ngsi-ld:FlowerBed:FlowerBed-345/attrs/location/value" \
# --header "Fiware-Service: carouge" \
# --header "Fiware-ServicePath: /watering" \
# | python -mjson.tool
\ No newline at end of file
......@@ -3,9 +3,11 @@
[[ -z "$ORION_HOST" ]] && echo "Please set ORION_HOST env var. E.g. export ORION_HOST=127.0.0.1" && exit
echo "Querying context broker at: ${ORION_HOST}"
curl --location --request PUT \
"http://$ORION_HOST:1026/v2/entities/urn:ngsi-ld:FlowerBed:FlowerBed-345/attrs/soilMoistureVwc/value"\
curl --location --request PATCH \
"http://$ORION_HOST:1026/ngsi-ld/v1/entities/urn:ngsi-ld:FlowerBed:FlowerBed-345/attrs/soilMoistureVwc"\
--header "Fiware-Service: carouge" \
--header "Fiware-ServicePath: /watering" \
--header "Content-Type: text/plain" \
-d $(( RANDOM % 10 ))
--header 'Content-Type: application/json' \
--data-raw '{
"type": "Property",
"value": 8
}'
......@@ -6,37 +6,23 @@ echo "Querying context broker at: ${ORION_HOST}"
[[ -z "$SUBSCRIPTION_URL" ]] && echo "Please set SUBSCRIPTION_URL env var. E.g. export SUBSCRIPTION_URL=http://172.18.1.11:5000/on_change_soilMoistureVwc" && exit
echo "Callback URL for subscriptions is: ${SUBSCRIPTION_URL}"
#doc: https://fiware-tutorials.readthedocs.io/en/latest/ld-subscriptions-registrations/index.html
curl --location --request POST \
"http://$ORION_HOST:1026/v2/subscriptions/" \
"http://$ORION_HOST:1026/ngsi-ld/v1/subscriptions/" \
--header "Fiware-Service: carouge" \
--header "Fiware-ServicePath: /watering" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--data '{
"description": "A subscription to subscribe to FlowerBed.soilMoistureVwc",
"subject": {
"entities": [
{
"id": "urn:ngsi-ld:FlowerBed:FlowerBed-345",
"type": "FlowerBed"
}
],
"condition": {
"attrs": [
"soilMoistureVwc"
]
}
},
"type": "Subscription",
"entities": [{"type": "FlowerBed"}],
"notification": {
"http": {
"url": "'${SUBSCRIPTION_URL}'"
},
"attrs": [
"soilMoistureVwc"
],
"attrsFormat": "keyValues"
},
"throttling": 5
"attributes": ["soilMoistureVwc"],
"format": "keyValues",
"endpoint": {
"uri": "'${SUBSCRIPTION_URL}'",
"accept": "application/json"
}
}
}'
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment