Can I send a x-www-form-urlencoded request in Mendix 7? And if yes how do I configure it?

0
For requesting an authentication token I'm required to do a x-www-form-urlencoded request to a POST endpoint. But I can't find any documentation on this being possible in Mendix 7 native REST implementations? Am I required to write a custom JAVA action or has someone else done this before and can you help with an example on how to configure this? cheers!
asked
4 answers
10

Hi Marnix,

You could try to use a regular POST action, add the custom header as Dennis mentioned, and then use a custom request template to build up the request. In the template / request body you specify each of the parameters as:

parameter1=value1&parameter2=value2&parameter3=etc

 

answered
0

Did you try the Custom HTTP headers in your REST consume action? Add an option with Key = Content-Type, value = x-www-form-urlencoded. See also https://docs.mendix.com/refguide/call-rest-action#3-2-custom-http-headers

answered
0

For anyone seeing this post I would like to add that instead of using Content-Type = x-www-form-urlencoded you should use (or could try) Content-Type = application/x-www-form-urlencoded in your custom header. That fixed it for me.

answered
0

I was successful when sending a x-www-form-urlencoded request as json file with the following configuration (Mendix V8.14.1):

Get the token:


(It is not clear why the Authorization needs  the parameter ‘eDp4’. The parameter was created with POSTMAN and UserName=’x’ and Password=’x’. Maybe it has something do do with my server, but without these parameter it does not work)

Get the data with the token:

 

$TokenObject/access_token is the token read before.

answered