update_notification_events

UsersApi.update_notification_events(update_notification_events_request, role_id=None, content_type=None, _request_timeout=None, _request_auth=None, _content_type=None, _headers=None, _host_index=0)

Mark notification events read or unread

Marks the caller’s events read or unread. No system-settings check. First id all updates every matching event from the last six months. Unknown ids stay 200 with a partial Message.

Parameters:
  • update_notification_events_request (UpdateNotificationEventsRequest) – (required)

  • role_id (str) – Amorphic role ID the request is authorized against. Must be a role the user belongs to. Also recorded in audit logs.

  • content_type (str) – Ignored by the handler.

  • _request_timeout (int, tuple(int, int), optional) – timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts.

  • _request_auth (dict, optional) – set to override the auth_settings for an a single request; this effectively ignores the authentication in the spec for a single request.

  • _content_type (str, Optional) – force content-type for the request.

  • _headers (dict, optional) – set to override the headers for a single request; this effectively ignores the headers in the spec for a single request.

  • _host_index (int, optional) – set to override the host_index for a single request; this effectively ignores the host_index in the spec for a single request.

Return type:

UpdateNotificationEventsResponse

Returns:

Returns the result object.

Request and Response Examples

HTTP: PUT /notifications/events

Request

Mark all unread events as read

{
  "Operation": "read",
  "NotificationEventIds": [
    "all"
  ]
}

Mark specific events unread

{
  "Operation": "unread",
  "NotificationEventIds": [
    "ntf-a2f7d3b1-8e5c-4a6f-9d1e-2b3c4d5e6f7a"
  ]
}

Success (HTTP 200)

Write finished. Message notes ids that were missing or not owned by the caller.

All requested ids updated

{
  "Message": "Successfully updated notifications"
}

Some ids were invalid or not owned

{
  "Message": "Successfully updated notifications except for ntf-missing because of invalid notification-id's or notifications doesn't belong to the user."
}

Errors

Documented error codes: PN-1002, GE-1008.

HTTP 400

Validation failure. Body is {“Message”: “<CODE> - <text>”}. Codes: PN-1002 (unknown Operation). The handler formats that catalog string with two args; a one-placeholder catalog can raise instead and become 500.

Operation is not read or unread

{
  "Message": "PN-1002 - Invalid update operation is passed - Notification events"
}

HTTP 500

Uncaught errors return {“Message”: “<str(ex)>”} with no GE-1008 wrap. Missing body keys, empty NotificationEventIds, and a PN-1002 format mismatch are 500.

NotificationEventIds missing from body

{
  "Message": "'NotificationEventIds'"
}

NotificationEventIds is empty

{
  "Message": "list index out of range"
}