Call a REST API with POST and request parameter

0
Hi! I want to call a REST API function with POST and a request parameter. In Swagger UI it works as follows: URL: ...actions/execute_query_json Parameters: request {take: 60, skip: 0, pageSize: 60, qid: "2", inline_Count:true, filters: "[]", sorts: "[]}   How can I pass this parameter(s) in Mendix? I tried it with an Export mapping, but I cannot select a parameter there, I guess I did something wrong. There is no parameter selectable. I just want to do the same thing like above.    
asked
4 answers
3

Hello Raimund,

Yes, set content-type as application/json and try, i believe that should work.

answered
2

Raimund,

In your microflow, before the REST call, you need to create a TaskQueryRequest object and set the attributes to the values you want to send in your request.  Once you do that you’ll be able to select that object as a parameter and you should be good to go.

Mike

**EDIT**

Yes, it will look like this:

answered
1

Now it works. HTTP Headers as follows

Regards, 

Raimund

answered
-1

Hello Mike,

thank you for your quick Response.

Now it compiled, but I get an error. Do I have to set the Content type to application/json, or something like this somewhere?

Status: 415
Reason: Unsupported Media Type
Content: {"Message":"The request contains an entity body but no Content-Type header. The inferred media type 'application/octet-stream' is not supported for this resource.","ExceptionMessage":"No MediaTypeFormatter is available to read an object of type 'Object' from content with media type 'application/octet-stream'.","ExceptionType":"System.Net.Http.UnsupportedMediaTypeException","StackTrace":" at System.Net.Http.HttpContentExtensions.ReadAsAsync[T](HttpContent content, Type type, IEnumerable`1 formatters, IFormatterLogger formatterLogger, CancellationToken cancellationToken)\r\n at System.Web.Http.ModelBinding.FormatterParameterBinding.ReadContentAsync(HttpRequestMessage request, Type type, IEnumerable`1 formatters, IFormatterLogger formatterLogger, CancellationToken cancellationToken)"}

answered