Quick start
A quick introduction to using the Laws.Africa Content API.
This quick start guide will get you started with fetching legislation from the Laws.Africa Content API. It includes:
Signing up for a Laws.Africa account
Listing available legislation
Fetching the HTML for a piece of legislation
Displaying the HTML
Create an account
To get started, you'll need a free Laws.Africa account and API token.
Sign up for a free Laws.Africa account at https://edit.laws.africa/accounts/login/
Get your API token from https://edit.laws.africa/accounts/profile/api/
Get a list of by-laws
Fetch a list of the by-laws (municipal legislation) for the City of Cape Town.
$ curl -H "Authorization: Token <YOUR_AUTH_TOKEN>" \
https://api.laws.africa/v3/akn/za-cpt/.jsonThe za-cpt part of the URL identifies the City of Cape Town in South Africa.
Fetch the Animal by-law
Let's fetch the details of Cape Town's Animal by-law, in JSON format. This includes the title, publication details and a list of other API calls you can make for additional details.
Laws.Africa can provide us with a Table of Contents for the by-law, also in JSON format. Let's fetch that:
Now let's get the HTML content of Section 3 of the by-law, regarding dog registration and licensing:
Display the by-law
Finally, let's put that HTML into a webpage and include the Laws.Africa Law Widgets to apply stylesheets to make it look good:

Next steps
The Tutorial goes step-by-step through building a Django application that display legislation fetched from the Laws.Africa Content API.
Browse the API documentation.
Last updated