Getting started
The following guide will help you get started with the integration with the DGM API. It will guide you through the process of setting up your application to access the API, and how to receive events.
If you have any questions, feel free to reach out to us.
Prerequisites
To get started with the DGM API, you'll need to have the following:
- Access to Maskinporten
- Access to the appropriate DGM scope in Maskinporten
Info
You can get an access code from us to get started before you have Maskinporten set up. This is intended for testing purposes only. Please refer to the authentication section for more information.
Step 1: Set up Maskinporten
Please refer to the documentation provided by Digdir for how to set up Maskinporten for your organization.
Relevant Resources
- What is Maskinporten
- Maskinporten
- How to use Maskinporten as an API consumer
- Technical Maskinporten API consumer guide
These links may become outdated, please refer to the Digdir documentation for the most up-to-date information.
Step 2: Get access to dgm scopes in Maskinporten
Dependent on who you are building a solution for, you'll need to get access to the appropriate DGM scope in Maskinporten. The following scopes are available:
dgm:funeralhome
dgm:graveyardauthority
Your organization can be delegated access to these scopes by the DGM team. Please reach out to us if you need access.
Step 3: Get an access token
To access the DGM API, you'll need to generate a JWT bearer token using Maskinporten. The bearer token is used to authenticate your application when accessing the DGM API and authorize your actions.
Info
Maskinporten supports two ways of authenticating you when generating an access token. Using an asymmetric key pair, or using a certificate. Please refer to the Maskinporten documentation for more information.
The very brief version of how to generate a bearer token using the asymmetric key approach is as follows:
- Create an integration in Maskinporten via Samarbeidsportalen
- Upload the public key of a JWK key pair to Maskinporten.
- Use the client ID and the private key to generate a JWT token with the needed scopes.
- Use the JWT token to get an access token from Maskinporten
The access token is a bearer token to access the DGM API.
For the details on how to do this, please refer to the Maskinporten documentation.
Step 4: Access the DGM API
With the access token, you can now access the DGM API. The API is documented here.
As a funeral home, use the dgm:funeralhome
scope and use the endpoints prefixed with /dgm/api/funeral-home
.
As a graveyard authority, use the dgm:graveyardauthority
scope and use the endpoints prefixed with
/dgm/api/graveyard-authority
.
Step 5: Subscribe to DGM events
DGM issues events to notify you of changes in the data. To receive events, you'll need to set up a subscription and provide a callback URL. The events are published to the callback URL as a cloud event.
To setup a subscription to receive events, you'll need to have Maskinporten setup for your organization, and you'll need to be added to an allowlist of organizations that can create subscriptions for the DGM resource that is relevant to you. To be added to this allowlist, reach out to us.
Please check out the Altinn documentation for how to setup a subscription here.
Read more about dgm events with its event types and resources here.