Overview
Production endpoint
https://muni-portal-backend.openup.org.za
/api/wagtail/v2/pages/
Find a page by path
/pages/path/find?html_path=...path...
responds with 302 to the page detail
$ curl -i localhost:8000/api/wagtail/v2/pages/find/?html_path=/services/
HTTP/1.1 302 Found
Date: Mon, 19 Oct 2020 18:06:27 GMT
Server: WSGIServer/0.2 CPython/3.8.1
Content-Type: text/html; charset=utf-8
Location: http://localhost:8000/api/wagtail/v2/pages/4/
Vary: Accept, Cookie, Origin
Allow: GET, HEAD, OPTIONS
X-Frame-Options: SAMEORIGIN
Content-Length: 0
$ curl -i localhost:8000/api/wagtail/v2/pages/find/?html_path=/my-muni/
HTTP/1.1 302 Found
Date: Mon, 19 Oct 2020 18:07:03 GMT
Server: WSGIServer/0.2 CPython/3.8.1
Content-Type: text/html; charset=utf-8
Location: http://localhost:8000/api/wagtail/v2/pages/7/
Vary: Accept, Cookie, Origin
Allow: GET, HEAD, OPTIONS
X-Frame-Options: SAMEORIGIN
Content-Length: 0
Get a specific page detail
GET
https://muni-portal-backend.openup.org.za/api/wagtail/v2/pages/:id/
Path Parameters
Name
Type
Description
id
string
{
"id": 15,
"meta": {
"type": "core.CouncillorPage",
"detail_url": "http://localhost:8000/api/wagtail/v2/pages/15/",
"html_url": "http://localhost:8080/my-muni/political-representatives/councillors/mr-busy-guy/",
"slug": "mr-busy-guy",
"show_in_menus": false,
"seo_title": "",
"search_description": "",
"first_published_at": "2020-10-19T16:27:39.827587Z",
"parent": {
"id": 14,
"meta": {
"type": "core.CouncillorListPage",
"detail_url": "http://localhost:8000/api/wagtail/v2/pages/14/",
"html_url": "http://localhost:8080/my-muni/political-representatives/councillors/"
},
"title": "Councillors"
}
},
"title": "Mr busy guy",
"overview": "<p>stuff</p>",
"councillor_groups": [
{
"id": 12,
"meta": {
"type": "core.CouncillorGroupPage",
"detail_url": "http://localhost:8000/api/wagtail/v2/pages/12/"
},
"title": "Mayor"
},
{
"id": 13,
"meta": {
"type": "core.CouncillorGroupPage",
"detail_url": "http://localhost:8000/api/wagtail/v2/pages/13/"
},
"title": "Some committee"
}
],
"person_contacts": [
{
"value": "1 Dirkie Uys",
"type": {
"label": "Physical address",
"slug": "physical_address",
"icon_classes": "fas fa-map-marked-alt"
},
"annotation": null
}
]
}
Find children of a page
/pages/?child_of=...pageid...
responds with the pages below the given page.
curl http://localhost:8000/api/wagtail/v2/pages/?child_of=7
{
"meta": {
"total_count": 2
},
"items": [
{
"id": 8,
"meta": {
"type": "core.AdministrationIndexPage",
"detail_url": "http://localhost:8000/api/wagtail/v2/pages/8/",
"html_url": "http://localhost:8080/my-muni/administration/",
"slug": "administration",
"first_published_at": "2020-10-19T16:13:03.981972Z"
},
"title": "Administration"
},
{
"id": 9,
"meta": {
"type": "core.PoliticalRepsIndexPage",
"detail_url": "http://localhost:8000/api/wagtail/v2/pages/9/",
"html_url": "http://localhost:8080/my-muni/political-representatives/",
"slug": "political-representatives",
"first_published_at": "2020-10-19T16:13:25.372792Z"
},
"title": "Political representatives"
}
]
}
Get pages matching a particular type and include the fields specific to this page type
GET
http://localhost:8000/api/wagtail/v2/pages/?type=core.ServicePage&fields=*'
Query Parameters
Name
Type
Description
fields
string
type
string
{
"meta": {
"total_count": 2
},
"items": [
{
"id": 5,
"meta": {
"type": "core.ServicePage",
"detail_url": "http://localhost:8000/api/wagtail/v2/pages/5/",
"html_url": "http://localhost:8080/services/electrical-services/",
"slug": "electrical-services",
"show_in_menus": false,
"seo_title": "",
"search_description": "",
"first_published_at": "2020-10-06T17:48:07.823000Z"
},
"title": "Electrical services",
"icon_classes": "fas fa-bolt",
"overview": "<p>The Department is responsible for all electricity services, including electrical infrastructure development.</p><p>The Municipality provides electrical distribution and reticulation services and street lighting to all towns in its area of jurisdiction except Struisbaai North (part of Struisbaai), Protem, Klipdale, Kassiesbaai (part of Arniston) and Elim.</p>",
"service_contacts": []
},
{
"id": 6,
"meta": {
"type": "core.ServicePage",
"detail_url": "http://localhost:8000/api/wagtail/v2/pages/6/",
"html_url": "http://localhost:8080/services/water-and-sanitation/",
"slug": "water-and-sanitation",
"show_in_menus": false,
"seo_title": "",
"search_description": "",
"first_published_at": "2020-10-06T17:48:46.915000Z"
},
"title": "Water and sanitation",
"icon_classes": "fas fa-tint",
"overview": "<p>Ensuring our residents have access to clean water is our priority. Fresh water is a scarce resource in the Western Cape that is heavily dependent on rainfall. We all have a part to play in conserving water as much as possible.</p>",
"service_contacts": [
{
"value": "012 345 1244",
"type": {
"label": "Phone",
"slug": "phone",
"icon_classes": "fas fa-phone-alt"
},
"annotation": "Landline"
},
.../
Last updated