/psgc-api

API for Philippine Standard Geographic Code - Updated March 2020

Primary LanguagePHP

PSGC API

Live API can be found in http://bkintanar.site. (Will change once I find the time to get a domain)

Postman: https://documenter.getpostman.com/view/78990/SWE3cKFB?version=latest

Data Source: https://psa.gov.ph/classification/psgc/

Notes from PSGC publication

  1. The total number of provinces in the PSGC excludes the four (4) districts of National Capital Region which have been assigned special Province Codes persuant to Presidential Decree No. 921.
  2. The City of Isabela and Cotabato City are assigned special Province Codes to show that they are not administratively part of ARMM but part of Region IX (Zamboanga Peninsula) and Region XII (SOCCSKSARGEN) repectively.
  3. The sub-municipalities of the City of Manila - Tondo I/II, Binondo, Quiapo, etc., are assigned special municipal codes but not officially considered municipalities.

Supported endpoints

+----------+------------------------------------------+
| Method   | URI                                      |
+----------+------------------------------------------+
| GET|HEAD | api/barangays                            |
| GET|HEAD | api/barangays/{barangay}                 |
| GET|HEAD | api/cities                               |
| GET|HEAD | api/cities/{city}                        |
| GET|HEAD | api/districts                            |
| GET|HEAD | api/districts/{district}                 |
| GET|HEAD | api/municipalities                       |
| GET|HEAD | api/municipalities/{municipality}        |
| GET|HEAD | api/provinces                            |
| GET|HEAD | api/provinces/{province}                 |
| GET|HEAD | api/regions                              |
| GET|HEAD | api/regions/{region}                     |
| GET|HEAD | api/sub-municipalities                   |
| GET|HEAD | api/sub-municipalities/{subMunicipality} |
+----------+------------------------------------------+

Pagination

Default pagination is set to 15 items per page. You can modify this by passing a per_page=# as a query parameter.

/api/regions?per_page=10

Includes

To include provinces

/api/regions?include=provinces
/api/regions/070000000?include=provinces

image

To include cities, municipalities in a given province

/api/provinces?include=cities
/api/provinces?include=municipalities
/api/provinces?include=cities,municipalities

image

image

To include barangays

/api/cities?include=barangays
/api/cities/072217000?include=barangays
/api/municipalities?include=barangays
/api/municipalities/072201000?include=barangays

image