User notifications
Getting notifications
The API provides the ability to get user notifications.
To get user notifications, issue the following GET request:
GET /api/notifications?top=5
Where:
- top: optional parameter to specify the number of notifications to get
Upon successful execution, an HTTP 200 OK status code is returned with a response body like the following:
[
{
"NotificationDate":"2017-06-27T19:58:29.177Z",
"Message":"You have been [@Action=granted]granted access[/] to folder [@Folder=7]Folder Xyz[/].",
"Links":{
"Self":"https://app.sharebase.com/sharebaseapi/api/notifications/2"
}
},
{
"NotificationDate":"2017-06-27T19:17:09.343Z",
"Message":"You have been [@Action=granted]granted access[/] to folder [@Folder=8]Folder Abc[/].",
"Links":{
"Self":"https://app.sharebase.com/sharebaseapi/api/notifications/1"
}
}
]
Where:
- NotificationDate: the date/time when the notification was initiated
- Message: the notification's message
- Links:
- Self: a hyperlink to the current notification
Getting a user notification
The API provides the ability to get a specific user notification.
To get a user notification, issue the following GET request:
GET /api/notifications/{notificationId}
Where:
- notificationId: the ID of the notification to get
Upon successful execution, an HTTP 200 OK status code is returned with a response body like the following:
{
"NotificationDate":"2017-06-27T19:58:29.177Z",
"Message":"You have been [@Action=granted]granted access[/] to folder [@Folder=7]Folder Xyz[/].",
"Links":{
"Self":"https://app.sharebase.com/sharebaseapi/notifications/2"
}
}
Where:
- NotificationDate: the date/time on which the notification was initiated
- Message: the notification's message
- Links:
- SelfUri: a hyperlink to the current notification
Note, if the notification does not exist for the current user, an HTTP 404 Not Found status code is returned.
Deleting user notifications
The API provides the ability to delete all user notifications.
To delete user notifications, issue the following DELETE request:
DELETE /api/notifications
Upon successful deletion, an HTTP 200 OK status code is returned.
Deleting a user notification
The API provides the ability to delete a user notification.
To delete a user notification, issue the following DELETE request:
DELETE {notificationUrl}
Where:
- notificationUrl: notification URL to delete - this URL can be obtained from the "Self" link in the embedded notification objects returned by the
GET /api/notifications
andGET /api/notifications/unread
APIs
Upon successful deletion, an HTTP 200 OK status code is returned.
Note, if a user tries to delete another user's notification, an HTTP 403 Forbidden status code is returned.
Getting unread user notifications
The API provides the ability to get unread user notifications.
To get unread user notifications, issue the following GET request:
GET /api/notifications/unread
Upon successful execution, an HTTP 200 OK status code is returned with a response body like the following:
[
{
"NotificationDate":"2017-06-27T19:58:29.177Z",
"Message":"You have been [@Action=granted]granted access[/] to folder [@Folder=7]Folder xyz[/].",
"Links":{
"Self":"https://app.sharebase.com/sharebaseapi/notifications/2"
}
},
{
"NotificationDate":"2017-06-27T19:17:09.343Z",
"Message":"You have been [@Action=granted]granted access[/] to folder [@Folder=2]Folder Abc[/].",
"Links":{
"Self":"https://app.sharebase.com/sharebaseapi/notifications/1"
}
}
]
Where:
- NotificationDate: the date/time on which the notification was initiated
- Message: the notification's message
- Links:
- Self: a hyperlink to the current notification