GET query JSON

0
Hi, I tried to do a database query (source: restdb.io) via a Get REST action. Getting all entries or limit them by '?max=2' works fine, but when I try to add a specifiy query in JSON style I get following error: Querying the database like this directly in browser or in NodeJS also works...  Could anyone give me a solution to do JSON style queries within Mendix? Thanks in advance!
asked
3 answers
5

Hi,

Besides using the urlEncode java action, you can also use the microflow expression urlEncode directly in the Call REST activity. 

  1. Open the Call REST activity
  2. Click the "Edit..." button after location
  3. In the Template field add a {1} placeholder
  4. Add a parameter and use urlEncode

 

 

More info about microflow expressions: https://docs.mendix.com/refguide/microflow-expressions

Grt. Arjan

answered
4

HI Alexendar,

You should Url Encode the request part of your call. So I would import the rest services module from the app store:

https://appstore.home.mendix.com/link/app/997/

Then use the urlEncode java action from this module to encode the part "'data-01?q={"LastName":"Muster"}'"

Then it works fine, at least I get a proper unauthorized returned :)

Regards

answered
0

Hi,

thank you for your answers, Arjan solutions works perfect!

I also tried the second solution, but adding the rest services module to my app caused these errors when I try to run my app:

 

Regards

answered