historic_01_set_up.sh 1 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
#!/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}"

# API NOTES:
# "condition": { "attrs": [] } -> means monitor all the attributes in the entity

curl --location --request POST \
    "http://$ORION_HOST:1026/v2/subscriptions/" \
    --header "Fiware-Service: carouge" \
    --header "Fiware-ServicePath: /Watering" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --data '{
      "description": "Notify QuantumLeap, the historic API, of all FlowerBed changes",
      "subject": {
        "entities": [
          {
            "idPattern": ".*",
            "type": "FlowerBed"
          }
        ],
        "condition": {
          "attrs": []
        }
      },
      "notification": {
        "http": {
          "url": "http://172.18.1.7:8668/v2/notify"
        },
        "attrs": [],
        "metadata": ["dateCreated", "dateModified"]
      }
}'