Sist endret: 19. aug. 2024

Cancel notification order

Endpoint for stopping the sending of a registered notification order

Endpoint

PUT /order/{id}/cancel

{id} represents the ID of the notification order to retrieve notifications for.

Authentication

This API requires authentication and the request must also include one of the following:

  • Maskinporten scope altinn:serviceowner/notifications.create (for external system callers)
  • Platform Access Token (for Altinn Apps and internal Altinn systems)

See Authentication and Authorization for more information.

Response

Response codes

  • 200 OK: The notification order was cancelled. No notifications will be sent.
  • 404 Not Found: No order matching the provided ID were found
  • 401 Unauthorized: Indicates a missing, invalid or expired authorization header.
  • 403 Forbidden: Indicates that required scope or Platform Access Token is missing or invalid.
  • 409 Conflict: The order cannot be cancelled due to current processing status

Content-Type

  • application/json

Response body

The response body is formatted as an NotificationOrderWithStatusExt.cs and serialized as a JSON string.

Find a short description of each property below.

id

Type: Guid

The ID of the notification order.

sendersReference

Type: string

The senders reference the creator provided in the notification order request.

requestedSendTime

Type: DateTime

The date and time for when the notification generated by the order should be sent.

creator

Type: string

The short name of the creator of the notification order.

created

Type: DateTime

The date and time for when the notification order request was registered.

notificationChannel

Type: enum NotificationChannel

The notification channel used for the notifications sent can be Email or Sms.

ignoreReservation

Type: boolean

Whether an individuals KRR reservation status should be ignored.

resourceId

Type: string

The ID of the Altinn resource the notifications should be related to as the ID appears in the Altinn Resource Registry.

processingStatus

Type: StatusExt

A status object describing the processing status of the notification order containing the properties below.

  • status: current processing status
  • description: an English description of the status and a timestamp
  • lastupdate: the date and time when the status was last updated
StatusDescription
RegisteredOrder has been registered and is awaiting requested send time before processing.
ProcessingOrder processing is ongoing. Notifications are being generated.
CompletedOrder processing is completed. All notifications have been generated.
CancelledOrder processing was stopped due to order being cancelled.

Examples

Request

In the example we have included place holders for both the Platform Access and Altinn token.

You only need one of them, reference Authentication for which one applies to your use case.

curl --location 'https://platform.altinn.no/notifications/api/v1/orders/f1a1cc30-197f-4f34-8304-006ce4945fd1/cancel' \
--header 'Content-Type: application/json' \
--header 'PlatformAccessToken: [INSERT PLATFORM ACCESS TOKEN]' \
--header 'Authorization: Bearer [INSERT ALTINN TOKEN]' 

Response

200 OK

Response body contains the notification order with status information.

Example: Successfully cancelled order response.

{
    "id": "f1a1cc30-197f-4f34-8304-006ce4945fd1",
    "sendersReference": "ref-2023-12-01",
    "requestedSendTime": "2023-12-12T14:13:27.836731Z",
    "creator": "digdir",
    "created": "2023-12-12T14:13:27.845029Z",
    "notificationChannel": "Email",
    "processingStatus": {
        "status": "Cancelled",
        "description": "Order processing was stopped due to order being cancelled.",
        "lastUpdate": "2023-12-12T14:13:27.845029Z"
    }    
}

40x responses

Response body contains problem details and status code

Example: 404 response body

{
  "type": "https://tools.ietf.org/html/rfc9110#section-15.5.5",
  "title": "Not Found",
  "status": 404,
  "traceId": "00-5249d76c03c137205ad8976fd9cd2e64-4d97ca7aea3f7489-00"
}