HttpPost response 400 error

I’m trying make a httpPost to get some information from another system. The problem is that i get a http response 400 that indicates that the body (post data) is not fomated correctly. The code looks like this:

Blockquote
url = “http://endpoint for deviations/get?fromDate=”+str(formatedFromDate)+"&toDate="+str(formatedToDate)
body = {
“equipmentIds” : “[100000511]”,
“statusIds”: “[100]”
}
header = {
“Authorization”: “Bearer “+token
}
deviations = system.net.httpPost(url,“application/json”,body,10000,60000,””,"",header,0,0)
Blockquote

The error that I get follow like this:
{u’traceId’: ‘|7d3ea763-40c9dd92084bf386.’, u’type’: ‘RFC 7231 - Hypertext Transfer Protocol (HTTP/1.1): Semantics and Content’, u’title’: ‘One or more validation errors occurred.’, u’errors’: {u’$’: [’’’’ is an invalid start of a property name. Expected a ‘"’. Path: $ | LineNumber: 0 | BytePositionInLine: 1.’]}, u’status’: 400}

Have anyone experienced a similar problem? The error seems to indicate a problem with the start of the “property name”. Is it a problem with the body that I’ve defined?

I’ve verified the call I’m trying to make using Swagger. There is nothing there indicating that this is not a correct postData body.

Thank full for any help that I could get
BR

You need to call system.util.jsonEncode on your body before you pass it to httpPost.

Or if you’re on Ignition 8.x you should use system.net.httpClient instead.

That did the trick! Thank you!
I’m on 8.4 on this gateway, so I will consider migrating the code to httpClient