using reef-pi API on my website

bleuchzsteve

Community Member
View Badges
Joined
May 5, 2022
Messages
56
Reaction score
20
Location
Chattanooga
Rating - 0%
0   0   0
I'm running a robo-tank with reef-pi and I've set up a web page that will broadcast a live view of my tank and live parameters. The issue I'm having is getting the data to display on the web page. The error I'm getting when trying to hit the API is not authorized, so I think the issue is because of the authentication page. Is anyone familiar with this? Is it possible to use the data even though its protected with the cookie layer? Thanks
 
OP
OP
bleuchzsteve

bleuchzsteve

Community Member
View Badges
Joined
May 5, 2022
Messages
56
Reaction score
20
Location
Chattanooga
Rating - 0%
0   0   0
so a bit of an update- i've got my reef pi set up and is monitoring temp and ph currently. love it. I'm still trying to figure out how to use GET requests to get the data and have it constantly appear on my webpage that i'm hosting on github pages (https://wrserne.github.io/) .

ive tried using a post request to get authentication and then use that in future requests..it seems like this works locally but that it wouldn't work for someone to access the data from their own computer when viewing the site.

I've tried cors-anywhere, i believe this also has the same issue of only working locally.

Chatgpt tells me I can make my own API to broadcast the data and then hit that API to view it on my page.. I'm not opposed to doing this but something tells me there is an easier way.

I'm new to development and am probably overlooking or over thinking something so if anyone has any advice on how to achieve this i would greatly appreciate it! I just need my temp and ph values from the api to show up on the webpage.

cheers
 
OP
OP
bleuchzsteve

bleuchzsteve

Community Member
View Badges
Joined
May 5, 2022
Messages
56
Reaction score
20
Location
Chattanooga
Rating - 0%
0   0   0
I
are you passing the data thru you firewall on your router? can you acess the port from outside your network?
I don't believe i can access it from outside my network and im not sure about the firewall, im guessing I need to check the firewall and change the config so that it allows the traffic?
 

Sral

Valuable Member
View Badges
Joined
May 2, 2022
Messages
1,006
Reaction score
976
Location
Germany
Rating - 0%
0   0   0
I would be careful doing that.. you are better setting a vpn or something to access to reef-pi from an external network.

The site works when your home correct? Just not when you are someplace else.
I definitely agree, that’s a risky route to take.

I do however think that a vpn is not what he wants. As far as I understand he wants a publicly accessible webpage, e.g. on GitHub pages, that displays the data and Webcam lifestream.

A better way might be to use a service or interface on the internet where the PI itself is broadcasting its data to, like Adafruit IO, I think. GitHub pages might then get the data from there.
The other option would be to regularly send the data to GitHub pages using some kind of http interface there, although I don’t know whether that’s possible.
 

Ranjib

7500 Club Member
View Badges
Joined
Apr 16, 2016
Messages
9,843
Reaction score
17,056
Location
Pleasant Hill, Concord
Rating - 0%
0   0   0
Reef pi uses session based authentication, are you not able to use that in your script. An you share details of how you are getting the data out? Session auth is standard across languages
 
Back
Top