Native REST consume available in Mendix 6.6

8
Last Monday we released Mendix 6.6. You can now consume basic REST services without the need for the REST services module. You can find a nice writeup of this functionality in this blogpost: Consume REST services with native microflow actions. Please let us know if you have any questions or remarks in this thread. Thanks!
asked
4 answers
4

Hi Andrej,

I played a bit with the functionality yesterday. I think it is very promising because i was able to consume a REST service with a pretty complex JSON response within half an hour. The current implementation in a java action took me almost a day.

Creating a JSON response mapper using the JSON structure snippet worked also like a charm.

I experienced a difficulty though, for which i also filled ticket #466496 This service needs a simple JSON request as well, since JSON export mapping is not available i made a custom request template in the Call REST action where is put the JSON request so i could use parameters in this. However is raises an error in the modeler that braces should be followed by a number of digits or another brace. This way you're not able to use JSON requests even in text form and need to create a string variable in advance.

Another, but less important, issue (#477498) is that the names of the parameters in the custom request template are not automatically updated when you change the name of the parameters earlier in the microflow.

At last, i got a suggestion for a nice improvement in the JSON structure function. Since JSON has no schema you need to use an example file to create the structure. However because it only takes the first JSON object in an array you're not shure you handled al possible complexities, the modeler warns you for this though. This means you need to create a sample which has all possible complexities in the first object of the array. For simpler JSON responses this is no problem, however the example i used has 9557 lines. It would be nice if the modeler could read all objects of an array to tackle this.

Keep up the good work and i'm looking forward to the expose functionality!

answered
0

I am trying to use the google streetview api with this service. and I run into the following two problems:

  1. My adress string contains spaces. This leads to an error:

Illegal character in query: https://maps.googleapis.com/maps/api/streetview?size=400x300&location=Johan huizingalaan 277, 1066TWAmsterdam&key=MYAPIKEY com.mendix.integration.http.HttpLocation.toUri(HttpLocation.scala:24)

I would expect this to be possible or an option that parameters are URI encoded

  1. The service sends back an image file download. This is not a JSON object and is also not something that can be properly stored in a string. I am unsure how to get this file contents into a Mendix image object. Currently in the log I do see that Mendix creates a file

Downloading file without known filename, presenting ObjectStoreId as name: 42784196460019813

https://maps.googleapis.com/maps/api/streetview?size=400x300&location=Johan huizingalaan 277, 1066TWAmsterdam&key=AIzaSyAgyjmljJ432bnpa2wB7qIe9fRWiOqKk

answered
0

After playing around with Mendix 6.6.0 i noticed that the JSON format does not allow me to specify an optional parameter? Is there a way that the JSON format also allows you to specify optional elements?

answered
0

Hi, I have been trying to call a HTTP POST. I get an error: 302 Found. This is of course the HTTP-response but how can I handle it - I don't seem to be able to get the new location out of the response. Also: how to pass post data?

answered