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
This guide uses the Cape Town by-laws as example content, which is free and doesn't require an API subscription. Other content such as national laws require a subscription.
The 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.
Finally, let's put that HTML into a webpage and include the Laws.Africa Law Widgets to apply stylesheets to make it look good:
<script type="module" src="https://cdn.jsdelivr.net/npm/@lawsafrica/law-widgets@latest/dist/lawwidgets/lawwidgets.esm.js"></script>
<la-akoma-ntoso>
<section class="akn-section" id="section-3" data-id="section-3">
<h3>3. Dog registration and licensing</h3>
<section class="akn-subsection" id="section-3.1" data-id="section-3.1">
<span class="akn-num">(1)</span>
<span class="akn-content"><span class="akn-p">The <span class="akn-term" data-refersTo="#term-owner" id="trm78" data-id="trm78">owner</span> of a property where one or more dogs are kept must register the <span class="akn-term" data-refersTo="#term-dog" id="trm79" data-id="trm79">dog</span> or dogs with the <span class="akn-term" data-refersTo="#term-Council" id="trm80" data-id="trm80">Council</span>.</span></span>
</section>
<section class="akn-subsection" id="section-3.2" data-id="section-3.2">
<span class="akn-num">(2)</span>
<span class="akn-content"><span class="akn-p">Dog registration must take place within four months of the <span class="akn-term" data-refersTo="#term-dog" id="trm81" data-id="trm81">dog</span>’s birth or within 30 days of acquiring a <span class="akn-term" data-refersTo="#term-dog" id="trm82" data-id="trm82">dog</span> on property within <span class="akn-term" data-refersTo="#term-Council" id="trm83" data-id="trm83">Council</span>’s jurisdictional boundaries.</span></span>
</section>
<section class="akn-subsection" id="section-3.3" data-id="section-3.3">
<span class="akn-num">(3)</span>
<span class="akn-content"><span class="akn-p">The <span class="akn-term" data-refersTo="#term-Council" id="trm84" data-id="trm84">Council</span> may levy a <span class="akn-term" data-refersTo="#term-dog" id="trm85" data-id="trm85">dog</span> license fee in respect of a property where one or more dogs are kept.</span></span>
</section>
<section class="akn-subsection" id="section-3.4" data-id="section-3.4">
<span class="akn-num">(4)</span>
<span class="akn-content"><span class="akn-p">The amount of the <span class="akn-term" data-refersTo="#term-dog" id="trm86" data-id="trm86">dog</span> license fee may be determined in terms of a resolution of <span class="akn-term" data-refersTo="#term-Council" id="trm87" data-id="trm87">Council</span>. A reduced <span class="akn-term" data-refersTo="#term-dog" id="trm88" data-id="trm88">dog</span> license fee may apply for sterilized dogs.</span></span>
</section>
</section>
</la-akoma-ntoso>
Next steps
The Tutorial goes step-by-step through building a Django application that display legislation fetched from the Laws.Africa Content API.