Simple REST call not working - Mendix Forum

Simple REST call not working

0

Hi,

I have a really simple REST call that is retuning the Content of the HTTP response, and the output variable as Empty.  The call to the web service works fine as I can run it in a browser and Postman and get a result.  Both Mendix and the Web Service are running locally.  Am I missing something really obvious?  I am doing this exactly like another REST call that works fine.  It is ‘UserDetails’ that is empty.

Thanks

asked
3 answers
1

Saying that your JSON does not have a root element, you probably found the error. Once you add a root element to your JSON, the RESTcall is probably fine. Keep in mind that the root-object will only contain an association to the UserDetails. What the import mapping does is it only returns the root object and stores the UserDetails in an object associated to the root object. So you will have to do a retrieve UserDetail by association from the root object and you will be fine.

answered
0

OK I've got it!! Something was up with the JSON structure for sure. I seem to have had to jump through loops to get access to it. I had to make the RESTcall, retreive the object which ended up as a List, then I headed the list to get the one element in the JSON, and now I can see my data and use it. Still not totally sure why I had to do it that way but its working and thats the main thing!

answered
0

Ben

Did you set the loglevel for Rest Consume to trace and look at the request and response in the console?  This may give you some more idea what's going on.

Mike

 

answered