Search code examples
liferayliferay-7

Liferay - populate list from an external REST service


As a newbie to Liferay I want to populate an options list from an external REST service.

First I go to Forms, then Data providers. I add a data provider with a name, description, URL = https://restcountries.eu/rest/v2/all, no username / password, input 'name' / 'name' / text and output 'name' / 'name' / text. I save that info. As an alternative I tried to restrict the list to this url: https://restcountries.eu/rest/v2/all?fields=name. Without any improvement.

Then I create a form with an options list that is filled with using the data provider.

After creating a page, adding the form to the page, configuring it and finally publishing the page, the lists shows no country-names.

When looking at the Chrome developer options Network tab, the URL for the restcountries.eu is not called.

In the Configuration Panel / System settings / Data providers I both used the Access Local Network on or off. No difference.

Can you help me filling the list with the country names?

I just downloaded the Liferay CE version, so that will be newest version (July 29. 2021)


Solution

  • Liferay Forms Data providers are handled on server side, so it is normal to not see any request inside the network-debugger. I guess this is due to security/authentication issues that should not get exposed.

    There is a good help article about Data Providers, that also has some notes about troubleshooting and debugging. If the service is not called, it might not be properly connect to you form control field.