TRIGGER - IO Service

Status:
unibo Logo 2

TRIGGER

SoluTions foR mItiGatinG climate-induced hEalth thReats.

TRIGGER will deepen current understanding of the linkage between climate, health and ecosystems (exposome framework) and use this knowledge to advance society uptake at personal and policy level. To meet the ambition, TRIGGER will commit an interdisciplinary consortium of 22 partners in 15 countries that will develop an outreaching clinical study composed by a multi-dimensional approach that capitalizes also on existing retrospective studies and will build an international climate service for global health protection, in line with COPERNICUS initiatives. You can learn more about the project here

API
Declare an Issue
Generate OTP

RestFull API

In this manual we will describe the main functionalities of the TriggerIO server for the management of the data acquired and sent by the smartphone mobile app and other client services. The server is provided to the consortium partners through the web url https://trigger-io.difa.unibo.it/ (TriggerIO server, in the following). The server is hosted by the DIFA and the related url plays the role of reverse proxy for the storage server under the Cesia firewall.

Main variables +

Declare the main variables

All the following documented APIs assume the following variables:

email="test@test.com"
password="test"
proxy="https://trigger-io.difa.unibo.it"
            
API Authentication +

LogIn into the server API to obtain a secret token.

The access to the data and web services APIs is guaranteed by a user authentication protocol. The user authentication is a mandatory task to avoid the management (insertion and selection) of the data by unauthorized users/clients.

token=$(curl --data '{"email":"'$email'", "password":"'$password'"}' \
             --header "Content-Type: application/json" \
             --request POST \
             "$proxy/api/auth" \
             --silent)
echo $token
            
API Get +

GET list of records in `table` (e.g. `myair`)

To get the inserted data related to the `table` device, you can use this dedicated GET request. This API allows to query the entire table using all the available columns as parameters for a finer management of the inserted data. The selection of the output variable can be set in the special keyword value in the query string.

records=$(curl --header "Accept: application/json" \
               --header "Content-Type: application/json" \
               --header "token: $token" \
               --silent \
               "$proxy/api/myair/")
echo $records | jq
            
API Post +

POST - Insert a new record in `table` (e.g. `myair`)

The insertion of the PPG data is provided by this API. The POST request must include the authToken in the body, with all the other parameters stored as batch arrays.

status_code=$(curl --data '{"year": [2024, 2024], "month": [2, 2], "day": [12, 13], "hour": [12, 12], "minute": [30, 30], "second": [0, 0], "pm1": [0.0, 0.0], "pm25": [0.0, 1.0], "pm10": [1.0, 0.0], "pc03": [0, 1], "pc05": [1, 0], "pc1": [0, 0], "pc25": [1, 1], "pc5": [2, 2], "pc10": [4, 3], "temperature": [12.5, 13.5], "humidity": [1.4, 3.14], "pressure": [1, 2], "sound": [42, 12], "uvb": [12, 13], "light": [3, 4], "firmware": ["2.40.1", "2.40.1"], "deviceId": ["EF422CD1-6EEB-6E23-E607-865771ED66D6", "EF422CD1-6EEB-6E23-E607-865771ED66D6"]}'\
                   --header "Content-Type: application/json" \
                   --header "Accept: application/json" \
                   --header "token: $token" \
                   --request POST \
                   "$proxy/api/myair" \
                   --silent \
                   --write-out '%{http_code}' \
                   -o /dev/null)
if [[ "$status_code" -ne 200 ]] ; then
  echo "Request status FAILED - Error $status_code"
else
  echo "Request status SUCCESS - Record create success"
fi
            

Issue Reporting

Generate OTP credentials

-