OCS Notifications API (v1)
Check Server Capabilities
In order to find out if notifications is installed and enabled on the server, you can run a request against the capabilities endpoint.
-
Path:
ocs/v2.php/cloud/capabilities
-
Method:
GET
Request Parameters
Attribute | Type | Description |
---|---|---|
|
string |
The format to return the response in.
It can be either |
Get User Notifications
This endpoint supports retrieving a list of notifications for a user.
-
Path:
ocs/v2.php/apps/notifications/api/v1/notifications
-
Method:
GET
In order to get a single notification, you can send a
|
Request Parameters
Attribute | Type | Description |
---|---|---|
|
string |
The format to return the response in.
It can be either |
Returns
On success, the request returns either an XML (the default) or a JSON response, along with an HTTP 200 OK
status code, which shows the server’s notifications capabilities.
Specification
Optional elements are still set in the array, the value is just empty:
Type | Empty value |
---|---|
array |
|
string |
|
Notification Element
Field name | Type | Value description |
---|---|---|
|
array |
(Optional) An array of action elements. |
|
string |
The name of the app that triggered the notification. |
|
string |
The ISO 8601 date and time of when the notification was published. |
|
string |
(Optional) A link that should be followed when the subject/message is clicked. |
|
string |
(Optional) The translated, potentially longer, message that should be presented to the user. |
|
int |
The unique notification identifier. It can be used to dismiss a notification. |
|
string |
The ID of the object which the notification is about. The id can be used in PHP to mark a notification as resolved. |
|
string |
The type of the object which the notification is about. It can be used in PHP to mark a notification as resolved. |
|
string |
The translated short subject that should be presented to the user. |
|
string |
The user id of the user that receives the notification. |
Action Element
Field name | Type | Value description |
---|---|---|
|
string |
The translated short label of the action/button that should be presented to the user. |
|
string |
A link that should be followed when the action is performed/clicked. |
|
bool |
If the action is the primary action for the notification or not. |
|
string |
The HTTP method that should be used for the request against the link.
It can be one of |
Delete a User Notification
To delete a notification, send a DELETE
request against ocs/v2.php/apps/notifications/api/v1/notifications/<id>
-
Path:
ocs/v2.php/apps/notifications/api/v1/notifications/<id>
-
Method:
DELETE
Returns
On success, the request returns either an HTTP 100 Continue status code, and no response body.