Posting measurements results in 404 error


Hi there,

I’m successfully downloading predictions and saving them in InfluxDB. This is working great! The predictions are a bit off though, so I wanted to post back actuals to improve them. I’ve found the corresponding documentation, but cannot get it to work in my .NET application or using Postman. This is what I’m getting in my application, and postman behaves consistently:

JSON data: {“measurement”:{“period_end”:“2021-04-30T05:49:02.7465495Z”,“period”:“PT5M”,“total_power”:“0”}}
Result: System.Net.WebException: The remote server returned an error: (404) Not Found.

According to the documentation this means my site-id is unknown, but I double checked this multiple times and it is correct. Any suggestions?



Need some more information because your data seems ok if you want to do single measurement uploads (I would suggest multiple measurements at a single time option)

Check it out in POSTMAN<MY_SITE>/measurements?api_key=<MY_API_KEY>



C# from RestSharp (use Flurl not RestSharp in my opinion)

var client = new RestClient("<MY_SITE>/measurements?api_key=<MY_API_KEY>");
client.Timeout = -1;
var request = new RestRequest(Method.POST);
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n    \"measurement\": {\n        \"period_end\": \"2021-04-30T05:49:02.7465495Z\",\n        \"period\": \"PT5M\",\n        \"total_power\": \"0\"\n    }\n}",  ParameterType.RequestBody);
IRestResponse response = client.Execute(request);

If a “bit off“ for you is like ~15mins: I subtracted 15 mins (=15k ms) from the timestamp before writing to influx, because it marks the end of a 30min period and so applies to the average over that whole time period. After that the predictions matched perfectly (on a sunny day at least). As you just have points every 30mins, though, it‘s anyway not very precise on more cloudy days. A lot of peaks get lost in between, I found…

1 Like

Thank you for the responses. In the end I switched from URL authentication to header authentication. This did the trick, which is a bit weird.

The 15 minute shift is a good idea! I totally forgot the 30 minute interval and that the deviation could be related to this.

1 Like