-
Get your auth token like this:
curl -X POST \ --header 'Content-Type: application/json' \ --header 'Accept: application/json' \ -d '{"username":"[your username]","password":"[your password]"}' \ 'https://[thingsboard url]/api/auth/login'
You will receive something like this:
{"token":"[really long string]","refreshToken":"[really long string]"}
Your auth token is the
token
value. -
Edit
export-tb-data.sh
with your settings:
-
THINGSBOARD_URL
- URL to your TB install -
DEVICEID
- find the device ID by going to Devices, click on the device, then "Copy Device ID" -
KEYS
- the names of the data values you send to TB.key1,key2
-
ENDTS
- the current unix time in milliseconds, see www.epochconverter.com.startTs
is set to January 1st 2001 at 12:00 AM. TB will give you all values between Jan. 1st 2001 and what you put forENDTS
. -
OUTFILE
- the name of the file to put the exported data in
-
Then run:
bash export-tb-data.sh > tb-data.json
Depending on the size of your data it could take over 2 minutes and the output file can be over 50 mb.
If there is an error just retry.
-
In the output file, data will be unformatted one line. It will have this structure:
{ "gas": [ { "ts": 1479735870786, "value": "1" }, { "ts": 1479735871857, "value": "2" } ], "temperature": [ { "ts": 1479735870786, "value": "3" }, { "ts": 1479735871857, "value": "4" } ] }
To view your data just do
cat tb-data.json
. Don't try to open it in any program or editor if the file is over 1mb.