Skip to content

Storage API

David Salek edited this page Jul 20, 2017 · 4 revisions

The Storage API allows you to query data and list devices for which data is stored by the Storage Integration. Data is stored for 7 days. https://www.thethingsnetwork.org/docs/applications/storage/

Swagger API: https://gps_tracker_sodaq_workshop.data.thethingsnetwork.org/

Here is a python code snippet that gets the data:

import requests, json

url = 'https://gps_tracker_sodaq_workshop.data.thethingsnetwork.org/api/v2/query?last=12h'
headers = {'Accept': 'application/json', 'Authorization': 'key ttn-account-v2.xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'}
res = requests.get(url, headers=headers)
data = res.json()

This is an example data from one event with the battery status in channel 2 and temperature in channel 3:

{u'raw': u'AgJooANnAPo=', u'analog_in_2': 267.84, u'time': u'2017-07-20T12:34:53.197344941Z', u'temperature_3': 25, u'device_id': u'my_first_sodaq_one'}
Clone this wiki locally