This is an API to subscribe to notification on changes to persons. Should be used in combination with the Haal Centraal Proxy API.
This API has been developed to replace functionality of MakelaarsSuite (MKS). It allows users to follow updates on the BRP.
Requirements:
- Python >= 3.13
- Recommended: Docker/Docker Compose (or pyenv for local installs)
Run docker compose:
docker compose upNavigate to localhost:8096.
Create a virtualenv:
python3 -m venv venv
source venv/bin/activateInstall all packages in it:
pip install -U wheel pip
cd src/
make install # installs src/requirements_dev.txtStart the Django application:
export PUB_JWKS="$(cat jwks_test.json)"
export DJANGO_DEBUG=true
./manage.py runserver localhost:8000The following environment variables are useful for configuring a local development environment:
DJANGO_DEBUGto enable debugging (true/false).LOG_LEVELlog level for application code (default isDEBUGfor debug,INFOotherwise).AUDIT_LOG_LEVELlog level for audit messages (default isINFO).DJANGO_LOG_LEVELlog level for Django internals (default isINFO).PUB_JWKSallows to give publically readable JSON Web Key Sets in JSON format (good default:jq -c < src/jwks_test.json).
Deployment:
ALLOWED_HOSTSwill limit which domain names can connect.AZURE_APPI_CONNECTION_STRINGAzure Insights configuration.AZURE_APPI_AUDIT_CONNECTION_STRINGSame, for a special audit logging.CLOUD_ENV=azurewill enable Azure-specific telemetry.STATIC_URLdefines the base URL for static files (e.g. to point to a CDN).OAUTH_JWKS_URLpoint to a public JSON Web Key Set, e.g.https://login.microsoftonline.com/{tenant_uuid or 'common'}/discovery/v2.0/keys.OAUTH_CHECK_CLAIMSaudience en issues checks for OAUTH
Hardening deployment:
SESSION_COOKIE_SECUREis already true in production.CSRF_COOKIE_SECUREis already true in production.SECRET_KEYis used for various encryption code.CORS_ALLOW_ALL_ORIGINScan be true/false to allow all websites to connect.CORS_ALLOWED_ORIGINSallows a list of origin URLs to use.CORS_ALLOWED_ORIGIN_REGEXESsupports a list of regex patterns fow allowed origins.
Run make in the src folder to have a help-overview of all common developer tasks.
The packages are managed with pip-compile.
To add a package, update the requirements.in file and run make requirements.
This will update the "lockfile" aka requirements.txt that's used for pip installs.
To upgrade all packages, run make upgrade, followed by make install and make test.
Or at once if you feel lucky: make upgrade install test.
Consider using direnv for automatic activation of environment variables.
It automatically sources an .envrc file when you enter the directory.
This file should contain all lines in the export VAR=value format.
In a similar way, pyenv helps to install the exact Python version,
and will automatically activate the virtualenv when a .python-version file is found:
pyenv install 3.13.1
pyenv virtualenv 3.13.1 brp-kennisgevingen-api
echo brp-kennisgevingen-api > .python-versionTo be able to test the functionality of the API we've included some initial mock data to test some scenarios. First load the fixtures using:
cd src
make load_fixturesIt is important to set environment variables for the OAUTH check claims to match the values in get_token.py:
export OAUTH_CHECK_CLAIMS="aud=0e1a03f2-4526-4159-a6dd-54236ad2006c,iss=https://issuer.test"Retrieve a token using:
./get_token.py benk-brp-volgindicaties-apiAnd use this token in your API calls:
curl --request GET \
--url http://localhost:8096/kennisgevingen/v1/volgindicaties \
--header 'Authorization: Bearer ${token}'