Notice the & replacing $ in body variable and the capital F in status=False, the server is complaining you sent a text string ‘false’ when it was expecting a boolean which is why i’m making this suggestion.
If that doesn’t work, then can you add a line Log ${file_data} and show us the result of both Log for ${file_data} and ${body} and hopefully we can spot the difference.
Another thing you can do is put exactly the same values in the ${body} dictionary as are in the static file then do something like this:
I think your close, don’t worry with the should be equal or Dictionaries Should Be Equal as the file is read as a binary string so is not going to be equal unless we either json decode the string or json encode the dictionary.
The post on session needs to be json not data when sending a dictionary, it’s done as the document said it would when you passed a dictionary o data and urlencoded the values not json encoded them
If that still doesn’t work It also might be useful to do this:
Create Session myssion ${api_url} headers=${header} disable_warnings=1
${file_data}= Get Binary File ../../${/}Resources${/}data.json
${response}= Post On Session myssion /api/v1/create data=${file_data}
&{body}= Create Dictionary customerName=rass status=False rejectionReason=${KWagrs} filingPeriod=04-2022 regionCode=33
${response}= Post On Session myssion /api/v1/create json=${body}
Then we can compare the difference between request bodies and headers on both Post On Session’s so we can see what’s different.
There are other options e.g.:
construct the body as a string and then send that string as the post data (basically similar to what you are doing with the file)
convert the dictionary to a json string, I think there was a library that did that, otherwise calling native python to do it
But I don’t think you’ll get there any quicker than trying to get your example above working, but if we don’t make any progress we can fall back to these.
@damies13
Root cause was passing status=False treating that as string .
Converted status to bool and passed then worked
${status}= Convert To Boolean ${status}