Problem for to implement request lib

Hi guys,

I allways work with RESTinstance lib, but now a need to make a request with x-www-form-urlencoded, and i saw that RESTinstance don’t work with this.

Then I migrated for request library, but I try here to do a simple POST with json, but this returns me 500, but on the same time in RESTinstance or with Postman the request return 200. I don’t know what I do wrong.

${Dict} Create Dictionary TargetBUS=Authentication TargetMethod=GenerateSecret Parameters=[ { “Name”: “param”, “Value”: { “UserId”: “${Client_Id}”, “CategoryID”: 9 }, “FullNameParameterType”: "BUS.Authentication.TokenTime.GenerateSecretParameterTokenTime, BUS.Authentication " } ]

${resp}= POST On Session jsonplaceholder /api json=${Dict}

I don’t know if I create dictionary correct.

Error: HTTPError: 500 Server Error: Internal Server Error for url: xxxxxxxxxxxxxxxxxxxxxx

Hi Victor,

Based on the documentation the first thing I would suggest you try is changing:
${Dict} Create Dictionary
to
&{Dict} Create Dictionary

Note the ‘&’ before ‘{Dict}’

http://robotframework.org/robotframework/latest/RobotFrameworkUserGuide.html#dictionary-variable-syntax

Hopefully that solves your issue,

Dave.

Tks damies13, but it’s still giving 500 error, I try to inplement with this ‘&’ too.

Another thing you could try is changing json=${Dict} to data=${Dict}

I remember seeing a post in the forum where that solved the issue for someone else.

Dave.

Also if you can give the body of the 500 error, sometimes there is a clue in there.

Dave.