Use Rest API to receive Token - Mendix Forum

Use Rest API to receive Token


Hey guys I´m currently trying to find out how to use  REST API´s in Mendix. 

I want to build a simple GET operation to receive a token. First I tried it by building a microflow and just add a “Call REST service” Action and add following code into the location field: ‘curl -X GET "http://**********/rest/api/***/Token" -H "accept: application/json" ’. It didn’t work. Than I tried to build a published Rest Service (like in the learning path). This didn´t work either for me. 

Please help!



3 answers

There's a learning path for the native REST in Mendix:
As well as documentation that I personally found very handy when I started with it; Consume a REST service:
And publish a rest service:

This documentation is for Mendix 7 btw since you said you were on 7.23
Your question is a bit too undetailed to properly understand where you go wrong with your problem.
Good luck!



This is my configuration of the REST service but it´s not working, I get this errors when I try to use the microflow: “An error has occurred while handling the request. [User 'Anonymous_50cfa956-9fe2-42a8-b9f8-645f8b937f29' with session id '9d877653-XXXX-XXXX-XXXX-XXXXXXXXb51d' and roles 'Administrator']” and a Client Error.  


It looks like you're on the right track using the Call REST service action.

However, you should use http://**********/rest/api/***/Token in the location field and add a header with Key=Accept and Value=application/json