Help:
$ sudo -u www-data ./occ notification:generate --help
Usage:
notification:generate [options] [--] <user-id> <short-message>
Arguments:
user-id #需要通知的用户ID
short-message #短消息内容(最多255个字符)
Options:
-l, --long-message=LONG-MESSAGE #长消息内容(最多4000个字符) [默认为:""]
例子:
$ sudo -u www-data ./occ notification:generate \
admin "Short message up to 255 characters" \
-l "Optional: longer message with more details, up to 4000 characters"
curl -H "OCS-APIREQUEST: true" -X POST \ https://<admin-user>:<admin-app-password-token>@<server-url>/ocs/v2.php/apps/admin_notifications/api/v1/notifications/<user-id> \ -d "shortMessage=<short-message>" \ -d "longMessage=<long-message>"例子:对照: admin-user: #具有管理员权限的用户的用户ID admin-app-password-token: #密码或“管理员用户”的“应用密码” server-url: #Nextcloud实例的根目录url user-id: #需要通知的用户ID short-message: #短消息内容(最多255个字符) long-message: #长消息内容(最多4000个字符)
curl -H "OCS-APIREQUEST: true" -X POST \ https://admin:admin@localhost/ocs/v2.php/apps/admin_notifications/api/v1/notifications/admin \ -d "shortMessage=Short message up to 255 characters" \ -d "longMessage=Optional: longer message with more details, up to 4000 characters"
状态码 | 含义 |
---|---|
200 | 信息发送成功 |
400 | 信息内容太长或短消息内容为空 |
404 | 未知的用户(用户ID错误) |
500 | 意外的服务器错误 |
503 | Nextcloud实例处于维护模式 |
GitHub:https://github.com/nextcloud/admin_notifications
[scbutton link=“https://github.com/nextcloud/admin_notifications/archive/master.zip” target=“blank” variation=“blue” class=“icon-download”]GitHub下载地址[/scbutton]