Error with very simple REST Call

0
Hi, I am trying to create a very simple rest call to the following URL https://passwordwolf.com/api/?length=8&upper=on&lower=on&numbers=on&special=off&repeat=1. This returns a small JSON response with 2 elements.  I only need the password element.  If I create a Variable output from the REST call, I can see the data in the variable so I know the call is acutally working.  What I am trying to do is to write the data to a non persisten entity so that I can use it in an email.  It's for a random password generation on the creation of a user.  I am using a blank app with no security as I am just running it as a test so I can export the module and use it in another project.  I am getting a Error 560 from Chrome and I notice that when I try and save the repsponse to the entity, the HTML content is empty and so is the entity.  Even though it saves the JSON string to a variable fine.   It's so simple but for some reason I can't get it working!  I have attached screen shots of my IMPORT Mapping, JSON structure,, the reposnse tab from the REST call, and the variable outputs.  Help! Thanks  
asked
2 answers
4

Hi Ben,

I just made the call using postman and the json returned doesnt match your json structure. It returns a list with a single object. 

Here is the postman call where I got the json to make json structure

 

Then I made this json structure and import mapping

 

 

Then created a microflow that looks like this

 

https://modelshare.mendix.com/models/e81dd824-7e3e-478e-8c05-c98514eff694/get-password

 

Here is my test project where I showed the result in a pop up page.

https://passwordwolf-sandbox.mxapps.io/index.html?profile=Responsive

 

Hope this helps!

 

Edit: Alternatively you could use the community commons random strong password java action. 

https://appstore.home.mendix.com/link/app/170/Mendix/Community-Commons-Function-Library

 

 

answered
0

That is awesome.  Thank you so much.  I did think it was the JSON structure but hadn't tried adding the [].  My understanding of JSON is still a little flaky.  I will check out the community's generator as well.

Thanks again!  

answered