This describes the Laws.Africa Content API. The latest version of the API is version 2.
This guide is for developers who want to use the Laws.Africa Content API to fetch legislative content and metadata from Laws.Africa. We assume that you have a basic understanding of REST APIs and the Akoma Ntoso standard for legislation (acts in particular).
API calls that return lists will be paginated and return a limited number of items per page. The response includes information on the total number of items and the URLs to use to fetch the next and previous pages of items.
Here's an example of the first page of a paginated response with 250 total items and two pages:
In this case, fetching the next URL will return the second (and final) page.
Some API calls can return content in multiple formats. You can specify the required content of your request by placing .format at the end of the URL. In most cases the default response type is JSON.
.json or Accept: application/json: return JSON
.xml or Accept: application/xml: return Akoma Ntoso XML
.html or Accept: text/html: return human friendly HTML
.epub or Accept: application/epub+zip: return an ePUB (ebook) document
.pdf or Accept: application/pdf: return a PDF document
.zip or Accept: application/zip: return a ZIP file with the document XML and media attachments
Not all responses support all formats, the documentation will be explicit about what is supported.
Using HTML Responses
Laws.Africa transforms Akoma Ntoso XML into HTML5 content that looks best when styled with Indigo Web stylesheets. You can link to the stylesheets provided by that package, or you can pull them into your website.