You have a few options for real time (or "near real time", which is when you have a delay between the collection & time to serve it, or for those that sample at a lower cadence)
There are a lot of considerations when dealing with 'real time' data:
- Who is the intended audience? (and do they already have standards for serving this type of data?)
- Is the data of value over the long term, or only ephemerally?
- If the data is of value long term, at what cadence does it need to be at to be of value? Does that cadence change as the data ages?
- If the data is ephemeral, what is the maximum age for which it's of value?
- What is the maximum latency acceptable for the data?
- How large is each record / observation?
- How would the intended audience expect to work with the data?
- How many people are going to be calling this API?
- Is the data useful individually, or only as part of a larger sensor network?
... I'm probably missing a few things ... but without knowing the answers, I can't say if it makes sense to :
- have an API that queries the sensors in real time
- have the sensor report in every few minutes and serve the latest value
- have some sort of data logger and serve the last 10 or 100 values
- log to a database and have a protocol for requesting data from a given period of time
- append each entry to a log, and roll the log every day (or hour, or some other time period).
If you're just looking to put up a few graphs on a website to show how much sunlight you get ... then just use RRDTool or something similar.
If you're trying to contribute back to a citizen science project ... you could look into the National Weather Service's Cooperative Observer Program. I don't know if they deal with solar irradiance though. DOE does, as they have their Solar Energy Potential map, but I don't know how they get the input for it. You can also try to find if there are any local mesonets in your area that need a node near you.
Also be aware that for some types of real time and NRT (near real time) data, there are APIs for reporting significant events, and interested parties connect and subscribe to the types of alerts they're interested in. Or individual sensors report back to some central clearing house, and people can then query that for data of interest. For instance, in astronomy there's the Gamma-ray Coordinates Network, for US earth science data, there's the NOAA Observing System Architecture.