You could use the country enumeration module and then you have all your countries and flags in one go. But to answer your question about consuming REST services. Most of the time REST services have a JSON as result. So you need to create in Mendix first a JSON activity where just copy paste the example JSON from the REST service. You then create an import mapping using the just created JSON. This will also create the non persistent objects for you if you want to. Now you can use a REST call action where you provide the URL and if needed your account and password or API key to do a GET action on that URL. And the response can then eiter be put in a string or mapped directly using the created import mapping.
All is also explained in this academy lesson here: https://academy.mendix.com/link/modules/138/lectures/1226/5.1-Consume-a-REST-Service
Regards,
Ronald
Hi Ronald,
Thanks for your reply. I already did all those steps and could get the list of the countries from the REST API. That's not the issue.
What I try to achieve is having an entity (let's say a 'Trip') referencing a country with a 1..* association (1 country, * trips). Here a my issues:
1. The association with a non persistent entity can only be in the not desired way
2. How can I use those objects in a form like this?
What I'd like to have is
- the combobox prefilled with all the countries
- the combobox preselected with the good country when I pass an object of type 'Trip'
- in the entity 'Trip', only store a unique code like the cca2 (or any other ISO code if i have it; this is just for the example).
I hope my question is clearer.
Thanks,
Gautier