26.3.0 26.2.0 26.1.0 25.4.0 25.3.0
26.3.0 26.2.0 26.1.0 25.4.0 25.3.0

Notifications API

You can use the Notifications API to tell the archive who to notify, for example when an ingest fails or a SIP has a virus. A notification configuration links one event to one channel. The channel is an email, a webhook call, or an event log that you can report on.

Every call needs the headers in Common headers.

Events you can be notified about

Set eventType to one of these values. Each event has a fixed severity, which you can filter on with event_severity.

eventType

When it happens

Severity

ingest_success

A SIP was ingested into its package.

Low

ingest_failed

A SIP couldn't be ingested.

Severe

sip_create_failed

The archive couldn't accept or validate a SIP.

Severe

aip_create_failed

The archive couldn't create or find the package for a SIP.

Severe

virus_found

The virus scan found a virus in a SIP.

Severe

plugin_failed

A preservation action failed on a package or a SIP.

Moderate

plugin_warning

A preservation action finished with a warning on a package or a SIP.

Low

documentRemoved

A package or a SIP was permanently deleted.

None. For event_severity, it counts as Low.

reportCreated

The archive generated a report. See Reports API.

Low

Channels

Set actionType to the channel, and put its settings in configuration:

  • EMAIL: sends an HTML email to the address in destination_mail.

  • WEBHOOK: sends a POST request to the URL in destination_url, with Content-Type: application/json. You can add your own headers in headers. If the call fails, the archive tries again up to three times, after 1, 2, and 4 seconds.

  • COLLECTION: logs each event in the event log that you name in destination_collection. To turn these events into a report, create a report_collection_query report in the Reports API.

Write the message template

notification_template is a FreeMarker template. The archive fills it in for each event, and sends the result as the email body or the webhook body. For a webhook, make sure that the result is the JSON that your endpoint expects.

You can use these variables:

Variable

Description

name

The event type, for example ingest_failed.

message

What happened, in a short English sentence.

severity

Low, Moderate, or Severe.

packageId

The ID of the package or the SIP. Unknown for reportCreated.

packageType

AIP or SIP. Unknown for reportCreated.

time

When the event happened.

reportId, reportName, reportFormat, reportConfig

For reportCreated only: the report's ID, file name, format, and configuration name.

For documentRemoved, message and severity have no value. A template that uses them sends nothing, so use only name, packageId, packageType, and time.

For example, a webhook template that sends JSON:

JSON
{
  "event": "${name}",
  "severity": "${severity}",
  "package": "${packageId}",
  "message": "${message}"
}

When you save the configuration, the archive tries the template with sample values for every severity and package type. If the template uses a variable that isn't in the list, or can't be processed, the save fails.

List notification configurations

GET /v2/notifications/configs

Required role: archive-content-manager

Name

Type

Required

Description

page

integer

No

The page number, starting at 0. Default: 0.

pageSize

integer

No

The number of configurations per page. Default: 100.

Response: 200 OK with a NotificationConfigList, sorted by name.

Get a notification configuration

GET /v2/notifications/configs/{configId}

Required role: archive-content-manager

Name

Type

Required

Description

configId

string

Yes

The ID of the notification configuration.

Response: 200 OK with a NotificationConfig.

  • 404: there's no notification configuration with this ID.

Create a notification configuration

Sets up a notification. It applies to the events that happen after you save it.

POST /v2/notifications/configs

Required role: archive-content-manager

Name

Type

Required

Description

name

string

Yes

The name of the configuration.

eventType

string

Yes

The event that triggers the notification. See Events you can be notified about.

actionType

string

Yes

EMAIL, WEBHOOK, or COLLECTION. See Channels.

configuration

object

Yes

The settings of the notification. See the next table.

enabled

boolean

No

If false, the archive doesn't send this notification. Default: true.

The configuration object takes these keys:

Name

Type

Required

Description

notification_template

string

Yes

The FreeMarker template of the message. Only EMAIL and WEBHOOK use it. For COLLECTION, send any valid template. See Write the message template.

destination_mail

string

For EMAIL

The email address to send to.

destination_url

string

For WEBHOOK

The URL to call, with http or https. It can't hold a user name or password. The archive also refuses localhost and IP addresses in private ranges.

headers

array of objects

No

For WEBHOOK only: extra request headers, each as an object with headerKey and headerValue.

destination_collection

string

For COLLECTION

The name of the event log to write the events to.

event_severity

string

No

The lowest severity that triggers the notification: low, moderate, or severe. Not case-sensitive. Leave it out to be notified for every severity.

JSON
{
  "name": "Ingest failures to the DMS",
  "eventType": "ingest_failed",
  "actionType": "WEBHOOK",
  "enabled": true,
  "configuration": {
    "destination_url": "https://dms.example.com/hooks/archive",
    "headers": [
      { "headerKey": "X-Api-Key", "headerValue": "example-key" }
    ],
    "notification_template": "{\"event\": \"${name}\", \"package\": \"${packageId}\", \"message\": \"${message}\"}"
  }
}

Response: 200 OK with the NotificationConfig.

  • 400 with REQUIRED_FIELD: notification_template, or the destination that the channel needs, is missing.

  • 400 with INVALID_VALUE: the configuration has a setting of another channel, the destination_url isn't allowed, or the template uses a variable that isn't available.

  • 400 with INVALID_FORMAT: the template isn't valid FreeMarker.

  • 400 with UNSUPPORTED_VALUE: event_severity isn't low, moderate, or severe.

Update a notification configuration

Replaces the configuration with the body that you send. The body has the same fields as Create a notification configuration, so send all of them.

PUT /v2/notifications/configs/{configId}

Required role: archive-content-manager

Response: 200 OK with the updated NotificationConfig.

Delete a notification configuration

DELETE /v2/notifications/configs/{configId}

Required role: archive-content-manager

Response: 204 No Content. The archive stops sending this notification.

  • 404: there's no notification configuration with this ID.

Schemas

NotificationConfig

Field

Type

Description

id

string

The ID of the configuration.

name

string

The name of the configuration.

eventType

string

The event that triggers the notification.

actionType

string

EMAIL, WEBHOOK, or COLLECTION.

configuration

object

The settings, with the keys that you sent. It also holds destination_type: email, webhook, or reporting, to match actionType.

enabled

boolean

Whether the archive sends the notification.

createdAt

string (date-time)

When the configuration was created.

NotificationConfigList

Field

Type

Description

totalResults

number

The number of configurations.

page

number

The page number.

pageSize

number

The page size.

items

array of NotificationConfig

The configurations in the page of results.