Create a REST client component definition:
Create a REST client component script:
Now add the Javascript Model:
Add the REST client javascript:
Make that component available on some page, then add it:
If something fails to work at this point, you might be missing the JavaScript Models module ... install it by adding the following to your webapp pom:
If you still can't get it to work, simple download http://pvnp.us/REWE/javascript-model-samples.tgz, and unpackage it into your light-modules directory. Make sure you make the service available on your page template:
Try it out - add a rest component to your symlinky page:
Overview
Content Tools
2 Comments
Bradley Andersen
https://documentation.magnolia-cms.com/display/DOCS55/JavaScript+Models+module
git clone ssh://git@git.magnolia-cms.com/light-modules/javascript-model-samples.git
Bradley Andersen
You could do other / more things with the Jokes Client. For example, if the API we are calling has different methods available; or, we can use
restfn
to parse the results further - we don't need to collect all the entries. We could even decorate the rendering module to point to a different Java class which overridesrestfn
and adds functionality.