security_03_request_with_token.sh 671 Bytes
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
#!/usr/bin/env bash

# reference doc: https://fiware-tutorials.readthedocs.io/en/latest/pep-proxy/index.html

[[ -z "$FIWARE_PROXY_HOST" ]] && echo "Please set FIWARE_PROXY_HOST env var. E.g. export FIWARE_PROXY_HOST=127.0.0.1" && exit
echo "Querying Fiware entrypoint (PEP_PROXY) at: ${FIWARE_PROXY_HOST}"

[[ -z "$KEYROCK_TOKEN" ]] && echo "Please set KEYROCK_TOKEN env var. E.g. export KEYROCK_TOKEN=****" && exit

curl -X GET \
  "http://$FIWARE_PROXY_HOST:1027/v2/entities/urn:ngsi-ld:FlowerBed:FlowerBed-345/attrs/soilMoistureVwc/value"\
  --header "Fiware-Service: carouge" \
13
  --header "Fiware-ServicePath: /Watering" \
14
15
  --header "X-Auth-Token: $KEYROCK_TOKEN"