This API is built on Flask and connects to a mongoDB storage attached to this app. The purpose is receiving HTML POST messages from Actility every time a LoRaWAN packet has been received. Spaghetti API stores all the relevant data and prepares them to be fetched with other apps connecting with REST API.
- Install Python
- Install Setuptools and pip (see guide above)
- Install Virtualenv (acconplish this by running
pip install virtualenv
) - Run
virtualenv venv
- Run
source venv/bin/activate
on Mac OS X/Linux orvenv\Scripts\activate.bat
on windows - Run
pip install -r requirements.txt
- Run
python app.py
- Visit http://localhost:3000
- Install the cf CLI
- Run
cf push my-python-app -m 128M --random-route
- Visit the given URL
The app route /sc_lpn
handles the data input from Actility Thingpark with HTTP POST in the format given by Actility.
App route /gateway
can handle the input of new gateways to be stored in the database, when used with HTTP POST.
Arguments:
id
: gateway EUI as a string
lat
: latitude of the gateway
lon
: longitude of the gateway
App route /import
can import from a backup point-by-point. All the point information has to be given as arguments. The function is not tested yet, for this purpose, a script needs to be written that transforms the .json backup into a series of POST requests.
App route /gateway
with HTTP GET returns all the gateways within a certain radius around the center point.
Arguments:
lat
: latitude of the center point
lon
: longitude of the center point
radius
: radius in km, output will contain all gtws within this radius.
App route /json
returns a .json file for download, containing the current point database. Might take some CPU...
App route /query
is filtering the database for certain criteria and only returns the points of interest.
Arguments:
delpoint
+timestamp deletes a specific point
track
: returns only a specific track number. Default: 20
start
: String with start time. Default: 1 year ago
end
: String with end time. Default: now
hdop
: maximum GPS HDOP. Default: 500
sf
: Spreading factor. Default: 7
txpow
: Transmission power. Default: 0
device
: Filter for transmissions of a specific device EUI only. Default: All devices
The additional app routes /freeboard/devices
and /freeboard/dbmonitor
were created to push statistics to a Freeboard.