Challenge 14

Dynamically Fetch Content via a REST API and Include it in Your Module



Often you may want to include content from external sources that might be updated or adjusted over time, or you might want to include a widget or another dynamic element in your content that you would like to stay up-to-date or that you would like to rebrand for your purposes. Rather than copying and pasting such elements into your system as static entities, you can dynamically fetch them when the page is loaded with a REST API call. You can also add listeners to only load contents at certain times, such as only loading a glossary term if a learner asks for it.


In your module, dynamically fetch content from EdTech Books or another service using a REST API call and add the content to your module. A simple and useful case would be fetching the definition to a term when a learner clicks on it.

Be sure to update the JavaScript to use your own API key. Otherwise, it will not work.

This content is provided to you freely by EdTech Books.

Access it online or download it at