There is no ESCAPE the Space

A project log for SolarEdge Meter

Monitoring a SolarEdge PV system through API's and an ESP32.

marcel-chabotMarcel Chabot 02/26/2024 at 00:480 Comments

I was having great success with the basic request for the current status. Things were working great. I wanted the 15 minute updated production history. This required a start date time and an end date time.

Every time I attempted to call that API it would yell at me. It worked fine in Postman, but the ESP32 would generate a 400 error at the web server.

The problem came down to dates. A lot of API's use a date format like YYYY-MM-DDTHH:MM:SS.sssssZ. The Solar Edge API use YYYY-MM-DD HH:MM:SS. The first format and variations of it are more common today. The issue with the date format used by Solar Edge is that it requires that you replace the space with a %20.

Postman makes this correction automatically, but in the ESP32 code, you have to remember to swap any spaces in the query string with %20 characters. This easy to overlook requirements is why first example with a T separating date and time is more common.

To any aspiring web service developers out there: Query string parameters requiring spaces should be avoided.