RESTful API which provides information on official divisional administrative regions of Portugal (based on "Carta Administrativa Oficial de Portugal, 2022", from here). It includes information on mainland Portugal, Azores and Madeira. It also provides information on Postal Codes and Census.
It uses NodeJS (much faster than Python) to create a HTTP server allowing several GET requests. It pre-processes all the raw data for fast real-time delivery.
All the API documentation is at geoapi.pt/docs.
This API follows the OpenAPI Specification, thus you can see all the routes in the openapi.yaml
file.
This is the main
public repo of the geoapi.pt project
The directory structure of the main project should be like:
./ # geoapi-pt/root (private)
├── resources/ # geoapi-pt/resources (private)
├── main/ # this repo (public)
By default the server replies with text/html
format. To receive JSON format, chose one of these:
- add the query GET parameter
json=1
to the URL (ex.:/municipio/évora?json=1
); - set the HTTP request header
Accept
as JSON, that is,Accept: application/json
; or - in case you're using the public API, use the host
json.geoapi.pt
(ex:json.geoapi.pt/cp/2495-300
)
For pretty-printing JSON as HTML response, use in the query ?json=belo
, for example /cp/2495-300?json=belo