You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: doc/sphinx-guides/source/api/native-api.rst
+48Lines changed: 48 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5889,6 +5889,8 @@ Notifications
5889
5889
5890
5890
See :ref:`account-notifications` in the User Guide for an overview. For a list of all the notification types mentioned below (e.g. ASSIGNROLE), see :ref:`mute-notifications` in the Admin Guide.
5891
5891
5892
+
.. _get-all-notifications:
5893
+
5892
5894
Get All Notifications by User
5893
5895
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
5894
5896
@@ -5898,6 +5900,52 @@ Each user can get a dump of their notifications by passing in their API token:
The expected OK (200) response looks something like this:
5904
+
5905
+
.. code-block:: text
5906
+
5907
+
{
5908
+
"status": "OK",
5909
+
"data": {
5910
+
"notifications": [
5911
+
{
5912
+
"id": 38,
5913
+
"type": "CREATEACC",
5914
+
"displayAsRead": true,
5915
+
"subjectText": "Root: Your account has been created",
5916
+
"messageText": "Hello, \nWelcome to...",
5917
+
"sentTimestamp": "2025-07-21T19:15:37Z"
5918
+
}
5919
+
...
5920
+
5921
+
Get Unread Count
5922
+
~~~~~~~~~~~~~~~~
5923
+
5924
+
You can get a count of your unread messages as shown below.
5925
+
5926
+
.. code-block:: bash
5927
+
5928
+
curl -H "X-Dataverse-key:$API_TOKEN" -X PUT "$SERVER_URL/api/notifications/unreadCount"
5929
+
5930
+
Mark Notification As Read
5931
+
~~~~~~~~~~~~~~~~~~~~~~~~~
5932
+
5933
+
After finding the ID of a notification using :ref:`get-all-notifications`, you can pass it to the "markAsRead" API endpoint as shown below. Note that this endpoint is idempotent; you can mark an already-read message as read over and over.
0 commit comments