I find out that even I let away the second argument of the request function I get the 301 error.
When I set the host to thethingsnetwork.org I get 200: ‘OK’.
Thanks for that!
Still when I use the ‘/api/v0/nodes/03FF8124’ in the request argument I get 301.
More suggestions?
EDIT: I solved the problem an extra slash was needed at the end of the argument thus:
For future debugging on 301 errors: print the final URL and visit using your browser -> you’ll see the redirect happen. Or debug the headers returned by the webserver (they contain the redirect).
@joeri_01
Hi Joeri,
Is it possible to read data using pandas.read_json from this Rest API?
Have you tried it with your data?
I have some data coming into my TTN console and getting stored on the default TTN Data Storage, see screenshot below:
If i try to read the json file from my swagger page using import requests into a dictionary and then putting that into a pandas dataframe. I get a JSONDecodeError: Expecting value: line 1 column 1 (char 0)
You can see my Jupyter Notebook in this link Can you please provide me any solution to read this data on the Swagger page into a pandas dataframe?
Okay, i found out how to read the data from TTN’s Swagger API in Python and wanted to share it with the TTN community as i am sure lot of people use python for data analytics/visualization.
You basically feed the Curl link in the TTN Swagger API page to this website (https://curl.trillworks.com/) and it will give you the required python code to parse the data using the python package import requests.
Remember to use import pandas as pd
and then you can parse the response into a pandas dataframe like so: df = pd.DataFrame.from_dict(response.json( ))
Can anyone advise, does this method of retrieving data using python still work? All I get is error 301 even though I’ve including all the things learnt along the way.
I’m trying to use this in along with the Storage Integration to have the TTN retain the data for 7 days allowing this code to run every few hours.