API Layer on top of Kaartenbak CMS, using Netlify functions.
/
- Returns an overview of all factsheets in HTML
/api/factsheet?id=${id}&format=${format}
- Returns factsheet details in either HTML or JSON
- Where
id
is the factsheet id - Where
format
is eitherhtml
orjson
/api/layer?id=${id}&format=${format}
- Returns layer metadata in either XML or JSON
- Where
id
is the layer id - Where
format
is eitherxml
orjson
/api/search?viewer=${viewer}&query=${query}
- Returns layers of a viewer in JSON
- Where
viewer
is the viewer name - Where
query
is the search query
/api/sync-layer
- Meant for the webhook of DatoCMS Kaartenbak. See below for the details.
/api/sync-viewer-layer
- Meant for the webhook of DatoCMS Kaartenbak. See below for the details.
The project includes an automated process for synchronizing external metadata between different systems. This functionality is implemented in the src/scripts/sync-external-metadata.js
file and scheduled via GitHub Actions.
The sync-external-metadata script performs the following operations:
- Connects to multiple DatoCMS instances (configured in the
instances
array) - Retrieves menu structures with layer information from each instance
- Identifies layers with external metadata references
- For each external metadata reference:
- Fetches the metadata XML from the source URL
- Transforms the XML by:
- Adding thumbnails
- Adding links
- Replacing IDs
- Uploads the transformed metadata to the destination Geonetwork instance
This process ensures that metadata is consistently synchronized across different systems, maintaining up-to-date information about layers and their properties.
The synchronization process runs automatically through GitHub Actions as defined in .github/workflows/sync-external-metadata.yml
:
- Runs daily at midnight (via cron: '0 0 * * *')
- Can be manually triggered via workflow_dispatch
- Uses Node.js 20 for execution
- Requires specific DatoCMS API keys stored as GitHub secrets
This automation ensures that metadata remains synchronized without manual intervention, maintaining consistency across the connected systems.