Downloading embedded images from the Laws.Africa Content API.
This guide will take you through how to work with images and other media embedded in expressions in Laws.Africa’s Content API. After reading this guide you will know:
how to list all the images and media included with an expression
how to download and save images and other media from the Content API
how to ensure that images are loaded correctly in your HTML content
What are embedded images?
Some legislation includes embedded images. You will need to download and store these images to ensure they are displayed when you show the legislation to your users.
You must download these images to include them in your HTML. The images will not be shown from the Laws.Africa servers.
Including images in your application or website
There are two steps to include embedded images in the legislation used in your app or website.
Download the images from the Laws.Africa Content API and save them to your server or app.
Ensure the HTML you fetch from the Laws.Africa Content API references the images correctly.
We'll go through each of these steps below.
How to list images using the Content API
The Laws.Africa Content API makes it easy to list and download embedded images for a particular work. Fetch the list of images using the /frbr-uri/media.json URL for the work. You can find this URL in the work's links array: