Cookie: {Cookie}
Cookie: JSESSIONID=s%3A7p3OOhM_sqNialZP2FrRffSDkRc8Df_j.rLd%2BKRj1zyrBW4spZRrCu%2B3APQ%2FR03ZFtBdVqe1u39E; __VCAP_ID__=b9bc469b-2975-4d4b-72f1-2798
export PDMS_BASE_URL="https://pdms-prep.pdms-at.cfapps.sap.hana.ondemand.com"
curl -s -I -X GET -H 'x-csrf-token:fetch' -H @headers.txt "${PDMS_BASE_URL}"/ain/services/api/v1/indicators | grep "X-Csrf-Token:" >> headers.txt
➜ ~ cat headers.txt
Cookie: JSESSIONID=s%3A7p3OOhM_sqNialZP2FrRffSDkRc8Df_j.rLd%2BKRj1zyrBW4spZRrCu%2B3APQ%2FR03ZFtBdVqe1u39E; __VCAP_ID__=b9bc469b-2975-4d4b-72f1-2798
X-Csrf-Token: e1e10f58e77dded7-MBul2yGuf0LAzxhkcFEWhivEvYA
curl -H @headers.txt \
"${PDMS_BASE_URL}"/ain/services/api/v1/indicators
export TEMPERATURE_INDICATOR_ID=`curl -X POST \
"${PDMS_BASE_URL}"/ain/services/api/v1/indicators \
-H @headers.txt \
-H 'Content-Type: application/json' \
-d '{"aggregationConcept":"6","dataType":"numeric","description":{"short":"Temperature"},"dimension1":"TEMP","expectedBehaviour":"4","internalId":"Temperature","indicatorCategory":"1","indicatorType":[{"code":"1"}],"indicatorUom":"GC"}' \
| jq -r '.id'`
export PRESSURE_INDICATOR_ID=`curl -X POST \
"${PDMS_BASE_URL}"/ain/services/api/v1/indicators \
-H @headers.txt \
-H 'Content-Type: application/json' \
-d '{"aggregationConcept":"6","dataType":"numeric","description":{"short":"Pressure"},"dimension1":"PRESS","expectedBehaviour":"4","internalId":"Pressure","indicatorCategory":"1","indicatorType":[{"code":"1"}],"indicatorUom":"HPA"}' \
| jq -r '.id'`
export HUMIDITY_INDICATOR_ID=`curl -X POST \
"${PDMS_BASE_URL}"/ain/services/api/v1/indicators \
-H @headers.txt \
-H 'Content-Type: application/json' \
-d '{"aggregationConcept":"6","dataType":"numeric","description":{"short":"Humidity"},"dimension1":"PROPOR","expectedBehaviour":"4","internalId":"Humidity","indicatorCategory":"1","indicatorType":[{"code":"1"}],"indicatorUom":"%"}' \
| jq -r '.id'`
export SCORE_INDICATOR_ID=`curl -X POST \
"${PDMS_BASE_URL}"/ain/services/api/v1/indicators \
-H @headers.txt \
-H 'Content-Type: application/json' \
-d '{"aggregationConcept":"2","dataType":"numeric","description":{"short":"Score"},"dimension1":null,"expectedBehaviour":"4","internalId":"Score","indicatorCategory":"1","indicatorType":[{"code":"2"}],"indicatorUom":null}' \
| jq -r '.id'`
export NORMALIZED_SCORE_INDICATOR_ID=`curl -X POST \
"${PDMS_BASE_URL}"/ain/services/api/v1/indicators \
-H @headers.txt \
-H 'Content-Type: application/json' \
-d '{"aggregationConcept":"2","dataType":"numeric","description":{"short":"Normalized Score"},"dimension1":null,"expectedBehaviour":"4","internalId":"Normalized_Score","indicatorCategory":"1","indicatorType":[{"code":"2"}],"indicatorUom":null}' \
| jq -r '.id'`
➜ ~ echo $TEMPERATURE_INDICATOR_ID
A079F81505EF4E1D9C9051A27FA50198
➜ ~ echo $PRESSURE_INDICATOR_ID
DD6162EFA3414924BE8C63DB8F24F4CB
➜ ~ echo $HUMIDITY_INDICATOR_ID
9EE9B2BFDDE047F195A6E8C521CA7E99
➜ ~ echo $SCORE_INDICATOR_ID
C58A2FEDE87F4001A5D46F34F4C5C0D4
➜ ~ echo $NORMALIZED_SCORE_INDICATOR_ID
A8A8DA94C9544519B6B8C8985EDAC795
export MEASUREMENTS_INDICATOR_GROUP_ID=`curl -X POST \
"${PDMS_BASE_URL}"/ain/services/api/v1/indicatorgroups \
-H @headers.txt \
-H 'Content-Type: application/json' \
-d '{"internalId":"Measurements","description":{"short":"Measurements"}}' \
| jq -r '.id'`
curl -X PUT \
"${PDMS_BASE_URL}"/ain/services/api/v1/indicatorgroups \
-H @headers.txt \
-H 'Content-Type: application/json' \
-d '{"internalId":"Measurements","description":{"short":"Measurements"},"indicators":[{"id":"'"$TEMPERATURE_INDICATOR_ID"'"}, {"id":"'"$PRESSURE_INDICATOR_ID"'"}, {"id":"'"$HUMIDITY_INDICATOR_ID"'"}], "id": "'"$MEASUREMENTS_INDICATOR_GROUP_ID"'"}'
export SCORES_INDICATOR_GROUP_ID=`curl -X POST \
"${PDMS_BASE_URL}"/ain/services/api/v1/indicatorgroups \
-H @headers.txt \
-H 'Content-Type: application/json' \
-d '{"internalId":"Scores","description":{"short":"Scores"}}' \
| jq -r '.id'`
curl -X PUT \
"${PDMS_BASE_URL}"/ain/services/api/v1/indicatorgroups \
-H @headers.txt \
-H 'Content-Type: application/json' \
-d '{"internalId":"Measurements","description":{"short":"Measurements"},"indicators":[{"id":"'"$SCORE_INDICATOR_ID"'"}, {"id":"'"$NORMALIZED_SCORE_INDICATOR_ID"'"}], "id": "'"$SCORES_INDICATOR_GROUP_ID"'"}'
curl -H @headers.txt \
"${PDMS_BASE_URL}"/ain/services/api/v1/indicatorgroups
➜ ~ echo $MEASUREMENTS_INDICATOR_GROUP_ID
B0D200C0011A9A2F16006F02A49D4058
➜ ~ echo $SCORES_INDICATOR_GROUP_ID
B1D200C0011A9A2F16006F02A49D4058
export MODEL_TEMPLATE_ID=`curl -X POST \
"${PDMS_BASE_URL}"/ain/services/api/v1/template \
-H @headers.txt \
-H 'Content-Type: application/json' \
-d '{"internalId":"Weather_Station_Template","description":{"short":"Weather Station Template"},"type":"3","indicatorGroups":[{"id":"'"$MEASUREMENTS_INDICATOR_GROUP_ID"'"}, {"id":"'"$SCORES_INDICATOR_GROUP_ID"'"}]}' \
| jq -r '.[].id'`
➜ ~ echo $MODEL_TEMPLATE_ID
14D700C0011A9A2F16006F02A49D4058
curl -H @headers.txt \
"${PDMS_BASE_URL}/ain/services/api/v1/organizations/byrole?roleid=1"
➜ ~ export ORG_ID="FA5C6E05E9584B05B7399F48A46534CB"
export MODEL_ID=`curl -X POST \
"${PDMS_BASE_URL}"/ain/services/api/v1/models \
-H @headers.txt \
-H 'Content-Type: application/json' \
-d '{"internalId":"Weather_Station","organizationID":"'"$ORG_ID"'","description":{"short":"Weather Station"},"equipmentTracking":"1","templates":[{"id":"'"$MODEL_TEMPLATE_ID"'","primary":true}]}' \
| jq -r '.modelId'`
➜ ~ echo $MODEL_ID
992BF5A057C840A893FE736BD01BA4A3
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
9 | |
6 | |
3 | |
3 | |
2 | |
2 | |
2 | |
2 | |
2 | |
1 |