using reef-pi API on my website

bleuchzsteve

Community Member
View Badges
Joined
May 5, 2022
Messages
56
Reaction score
18
Location
Chattanooga
What state or country do you live in
Tennessee
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
 
I will try this , thank you…I was thinking that authentication and cookies were two separate things but that makes sense,
 
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
 
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?
 
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.
 
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
 

TOP 10 Trending Threads

HOW MUCH DOES A FISH’S FEEDING REQUIREMENTS AFFECT YOUR STOCKING DECISIONS?

  • A lot! - I avoid fish that require frequent or specialized feeding

    Votes: 19 33.9%
  • Quite a bit, but an automatic feeder can change my answer

    Votes: 7 12.5%
  • It depends on whether my nutrient export can handle it

    Votes: 8 14.3%
  • It depends on how badly I want the fish

    Votes: 12 21.4%
  • Not much. I’m willing to adjust my routine

    Votes: 9 16.1%
  • Not at all. Feeding demands don’t limit my stocking choices

    Votes: 9 16.1%
  • I usually learn about the demanding feeding schedule after buying the fish!

    Votes: 2 3.6%
  • I haven’t really considered this before

    Votes: 4 7.1%
  • Something else (see my comments in the thread)

    Votes: 2 3.6%
Back
Top
Home
Post thread…
Market
What's new