400 bad request using addbatchstatus.jsp

Hello,

I’m trying to use ginlong-python to process my inverter data, then I’ve written another script to process the output more. I’d like to use the API to upload each day’s data using addbatchstatus.jsp , sending date,time,Wh_today,W_now as a batch:

curl -d "data=20211007,13:49,5800,1872;20211007,13:57,5900,470;20211007,14:05,6000,542;20211007,14:19,6100,515;20211007,14:27,6200,621;20211007,14:33,6200,538;20211007,14:40,6300,440;20211007,14:48,6300,493;20211007,15:00,6500,463;20211007,15:07,6500,417;20211007,15:13,6600,442;20211007,15:44,7300,463;20211007,15:57,7400,269;20211007,16:03,7400,219;20211007,16:10,7400,270;20211007,16:22,7600,1547;20211007,17:01,7800,220;20211007,17:09,7800,121;20211007,17:33,7900,48;20211007,18:04,7900,0;20211007,18:11,7900,0;20211007,18:18,7900,0" -H "X-Pvoutput-Apikey: mykey" -H "X-Pvoutput-SystemId: mysystem" https://pvoutput.org/service/r2/addbatchstatus.jsp

I’m getting this error:

<html><body><h1>400 Bad request</h1>
Your browser sent an invalid request
</body></html>

Can anyone see the problem in my example above?

Thanks for your time.

The only thing that comes to mind is that pvoutput is expecting a 5, 10, or 15 minute interval on the submission times, i.e. 14:05, 14:10, 14:15.
You’re submitting 13:49, 13:57, 14:05, 14:19. I haven’t tried doing this, so I don’t know if it is the issue here… I don’t know if the system cares.
You could try pushing data on a set interval and see whether that resolves the ‘bad request’ response.

Thanks for the suggestion, I just tried editing a sample file to give it 5 min intervals but got the same error.

I edited my curl command to give only 3 records and it worked! With either 5 min or irregular intervals.

I’m getting somewhere then, will keep trying this out…

Right, worked it out!

I am developing a script, I was switching between using echo curl [etc] and then removing echo to test the curl command once it seemed right, but I had left some escaped characters in the command (which echo needed). I removed the escapes and curl works as expected.

So - my data format was right and irregular time intervals don’t seem to matter.