Sending a Request Payload

I am trying to do a POST to my server which is expecting a Request Payload in JSON format not Form Data.
I am try this

const ScopedPointer stream(url.withPOSTData("{id:1,name:‘aaa’}").createInputStream(true, nullptr, nullptr, “Content-Type: application/json”, 0, &responseHeaders, &statusCode, 5, “POST”));

The server returns a 400.
Am I doing something wrong or is there no way to send a Request Payload?

I finally figured this out and it turns out to be pretty simple. The server wants double quotes so it thought the payload was binary data. I just needed to change the json to this

1 Like