You are not logged in.
Pages: 1
Hi,
I am trying to send a batch insert with postman to the sample 04- HTTP Server, but I get "TSQLRestServerDB.EngineBatchSend: Wrong POST" and only 2 inserted records for this example :
URI : localhost:8080/root/samplerecord/batch
{"samplerecord":["POST", { "Time": "135504637423","Name": "Name1","Question": "Question1"},
"POST", { "Time": "135504637423","Name": "Name2","Question": "Question2"},
"POST", { "Time": "135504637423","Name": "Name3","Question": "Question3"}
]
}
It seems like my json file is not complete.
Regards,
Offline
I guess the easiest is to see TSQLRestServer.EngineBatchSend expectations, and use the debugger to see what's wrong.
From the source, "Wrong POST" message indicates a wrong object after the "POST", item...
It sounds pretty unsafe to do so on production anyway...
Anyone with the URI could break your data...
Offline
I think the problem is at line 28828 of mormot.pas
P := GotoNextJSONObjectOrArray(Beg);
for the example above, this command returns the next jsonobject for the two first objects, but for the last one it retuns a null pointer what is normal and abort the post process with the exception "Wrong POST".
It sounds pretty unsafe to do so on production anyway...
Anyone with the URI could break your data...
What is the safe way to invoke a batch from a javascript client to prevent breaking data?
Regards,
Offline
Offline
Ok great that works without spaces/linefeeds.
I'll test your proposation about REST service.
Thank you AB.
Offline
Pages: 1