Consume REST: what to put in request?

We need to call a REST api where the following is supposed to work: curl --location --request POST "" --header "Content-Type: x-www-form-url-encoded" --data="" Now, in the call REST activity in my microflow, what do I put in the ‘Request’ part? I tried: email=”” email=”” --data=”” All failing miserably with response 422. What am I doing wrong? Edit: turns out it needs to be application/x-www-form-url-encoded instead of x-www-form-url-encoded. Why this results in a 422 is beyond me. Other than that, the request formatted as works. I appreciate the feedback and also accepted Nils' answer. The receiving party said that encoding wasn't necessary, but while @ is no problem, the endpoint threw an error when the email address contained a +.
2 answers

With content type “x-www-form-url-encoded” as the name indicates both the keys and values are URL encoded. So with curl you would actually get something like this.

curl --location --request POST "" --header "Content-Type: x-www-form-url-encoded" --data=""

In mendix you could use a ‘post’ REST action as described in this forum post below. Just make sure you don’t forget to URL encode the keys and values before adding it to the request body.


The error code is:

422 Unprocessable Entity

The server understands the content type of the request entity (hence a 415 Unsupported Media Type status code is inappropriate), and the syntax of the request entity is correct (thus a 400 Bad Request status code is inappropriate) but was unable to process the contained instructions.

For example, this error condition may occur if an XML request body contains well-formed (i.e., syntactically correct), but semantically erroneous, XML instructions.


Could it be something so simple that you really tried to supply instead or your own mail adres?
Otherwise check the other side why your mail address is not accepted.