This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
wiki:interfaces:webaw [2020/03/13 15:38] ghi created |
wiki:interfaces:webaw [2020/09/25 14:17] (current) hch [Authentication] |
||
---|---|---|---|
Line 44: | Line 44: | ||
LOGIN_RESULT=$(curl "$URL/application/administration/login" \ | LOGIN_RESULT=$(curl "$URL/application/administration/login" \ | ||
--data-binary '{"login":"spn","password":"spnpwd"}' \ | --data-binary '{"login":"spn","password":"spnpwd"}' \ | ||
- | --insecure -s \ | ||
) | ) | ||
#-------------------------------------------------------------------------------- | #-------------------------------------------------------------------------------- | ||
# extract the token from the server's reponse | # extract the token from the server's reponse | ||
- | # (Requires the json parser "jq") | + | # (Requires the json parser "jq" , sudo apt install jq) |
#-------------------------------------------------------------------------------- | #-------------------------------------------------------------------------------- | ||
TOKEN=$(jq .token <<< $LOGIN_RESULT |tr -d '"') | TOKEN=$(jq .token <<< $LOGIN_RESULT |tr -d '"') | ||
Line 72: | Line 71: | ||
# Download SPN gateway configuration | # Download SPN gateway configuration | ||
- | curl --insecure -s \ | + | curl -s \ |
"$URL/application/administration/configuration" \ | "$URL/application/administration/configuration" \ | ||
-H "Authorization: Bearer $TOKEN" \ | -H "Authorization: Bearer $TOKEN" \ | ||
Line 94: | Line 93: | ||
-H "Authorization: Bearer $TOKEN" \ | -H "Authorization: Bearer $TOKEN" \ | ||
-F file='@spn_config.json' \ | -F file='@spn_config.json' \ | ||
- | -i --insecure -s \ | ||
-H 'Expect:' \ | -H 'Expect:' \ | ||
| grep "204 No Content" \ | | grep "204 No Content" \ | ||
Line 117: | Line 115: | ||
# Add an end-device and search for the string "201 Created" | # Add an end-device and search for the string "201 Created" | ||
- | ADD_DEVICE_RESULT=$(curl -i --insecure -s \ | + | ADD_DEVICE_RESULT=$(curl -s \ |
"$URL/application/spn/end_devices" \ | "$URL/application/spn/end_devices" \ | ||
-H "Authorization: Bearer $TOKEN" \ | -H "Authorization: Bearer $TOKEN" \ | ||
- | --data-binary '[{"activation_type":"OTAA", | + | --data-binary '{ |
- | "class":"A","dev_eui":"0123456789123457", | + | "activation_type": "OTAA", |
- | "app_eui":"0000000000000000", | + | "dev_eui": "0122226789123457", |
- | "app_key":"12345678912345678912345678912345", | + | "app_eui": "0000000000000000", |
- | "dev_addr":"", | + | "app_key": "12345678912345678912345678912345", |
- | "nwks_key":"", | + | "dev_addr": "", |
- | "apps_key":"", | + | "nwks_key": "", |
- | "rx_window":3, | + | "apps_key": "", |
- | "rx_frequency":869525000, | + | "end_device_parameters": { |
- | "rx_datarate":0}]' \ | + | "rx_window": 3, |
- | | grep "201 Created" \ | + | "rx_frequency": 869525000, |
+ | "rx_datarate": 0, | ||
+ | "class": "A" | ||
+ | } | ||
+ | }' \ | ||
+ | | grep "201 Created" \ | ||
) | ) | ||
Line 149: | Line 152: | ||
# Add an end-device and search for the string "201 Created" | # Add an end-device and search for the string "201 Created" | ||
- | ADD_DEVICE_RESULT=$(curl -i --insecure -s \ | + | ADD_DEVICE_RESULT=$(curl -s \ |
"$URL/application/spn/end_devices" \ | "$URL/application/spn/end_devices" \ | ||
-H "Authorization: Bearer $TOKEN" \ | -H "Authorization: Bearer $TOKEN" \ | ||
Line 167: | Line 170: | ||
# GET RX data for all end-devices | # GET RX data for all end-devices | ||
- | curl --insecure -s \ | + | curl -s \ |
- | "$URL/application/spn/rxdata/file" \ | + | "$URL/application/spn/rx_data/file" \ |
-H "Authorization: Bearer $TOKEN" \ | -H "Authorization: Bearer $TOKEN" \ | ||
-H "Content-Type: application/vnd.kerlink.iot-v1+json" \ | -H "Content-Type: application/vnd.kerlink.iot-v1+json" \ |