Retrieving Structured Funeral Data

When you receive a notification about funeral data changes, you can retrieve the updated data in a structured format using the petition endpoints. This enables you to process funeral information more efficiently than with unstructured attachments.

Prerequisites

Before retrieving structured data:

  1. You must have appropriate authorization credentials
  2. A funeral responsible must be established for the funeral
  3. You should receive an event notification with the necessary identifiers

Warning

The funeral petition endpoints can only be used when a funeral responsible has already been set in DGM. If no funeral responsible is set, the funeral petition endpoints will not return any data (404 Not Found).

Implementation Steps

1. Receive an Event Notification

Events will include the identifiers you need to retrieve data:

{
  ...,
  "type": "no.dgm.v1.funeral.updated",
  "data": {
    "funeralId": "00000000-0000-0000-0000-000000000000",
    "responsibilityStatementId": "00000000-0000-0000-0000-000000000000",
    "partyId": "00000000-0000-0000-0000-000000000000",
    "locationIds": ["0301"],
    "funeralHomeId": "12345",
    "crematoriumId": null
  },
  ...
}

2. Verify Event Relevance

Determine if the event is relevant to your system based on:

  • locationIds: For graveyard authorities
  • crematoriumId: For crematoriums
  • funeralHomeId: For funeral homes

3. Retrieve the Responsibility Statement

Get the latest responsibility statement:

GET /dgm/api/graveyard-authority/responsibility-statements/{id}

or

GET /dgm/api/funeral-home/responsibility-statements/{id}

4. Retrieve petition data

Get the structured funeral petition data:

GET /dgm/api/v1/funeral-petitions/{partyId}

This endpoint will return a comprehensive data structure containing all components:

{
  "partyId": "00000000-0000-0000-0000-000000000000",
  "data": {
    "responsibilityStatement": {
      ...
    },
    "grave": {
      ...
    },
    "rites": [
      ...,
      ...
    ]
  }
}

5. Retrieve Type Definitions for Interpretation

To correctly interpret the rite and grave types in the petition, retrieve the type definitions:

GET /dgm/api/v1/definitions/grave-types
GET /dgm/api/v1/definitions/rite-types

6. Retrieve Additional Attachments (If Needed)

For any additional attachments associated with the funeral:

GET /dgm/api/graveyard-authority/attachments?Id={partyId}&associatedEntityType=party

Then retrieve each attachment by its file ID:

GET /dgm/api/graveyard-authority/attachments/{fileId}

Understanding Component Status

When retrieving petition data, be aware that each component may be in different states:

stateDiagram-v2 [*] --> Submitted Submitted --> PendingApproval PendingApproval --> Approved Approved --> [*]

Error Handling

Common errors when retrieving data:

Status Code Description Action
404 Data not found Check if a funeral responsible has been set
403 Not authorized Verify your authorization credentials
500 Server error Implement retry with exponential backoff

Best Practices

  1. Cache Definitions: Type definitions change infrequently - cache them
  2. Event-Driven Retrieval: Only fetch data when events indicate changes
  3. Merge Data: Merging the data should happen at your end, not in DGM

Next Steps

  1. Understand event subscriptions for staying updated
  2. Learn about common integration workflows