{ "openapi": "3.1.0", "info": { "title": "Notifications", "version": "2.13.1", "description": "This app provides a backend and frontend for the notification API available in Nextcloud.", "license": { "name": "agpl", "identifier": " AGPL-3.0" } }, "servers": [ { "url": "https://{hostname}:{port}", "variables": { "hostname": { "default": "localhost" }, "port": { "default": "8080" } } } ], "security": [ { "basic_auth": [] } ], "tags": [ { "name": "notifications" } ], "components": { "schemas": { "OCSMeta": { "type": "object", "required": [ "status", "statuscode" ], "properties": { "status": { "type": "string" }, "statuscode": { "type": "integer" }, "message": { "type": "string" }, "totalitems": { "type": "string" }, "itemsperpage": { "type": "string" } } }, "EmptyOCS": { "type": "object", "required": [ "ocs" ], "properties": { "ocs": { "type": "object", "required": [ "meta", "data" ], "properties": { "meta": { "$ref": "#/components/schemas/OCSMeta" }, "data": { "type": "array" } } } } }, "Notification": { "type": "object", "required": [ "notification_id", "app", "user", "datetime", "object_type", "object_id", "subject", "message", "link", "subjectRich", "subjectRichParameters", "messageRich", "messageRichParameters", "icon", "actions" ], "properties": { "notification_id": { "type": "integer" }, "app": { "type": "string" }, "user": { "type": "string" }, "datetime": { "type": "string" }, "object_type": { "type": "string" }, "object_id": { "type": "string" }, "subject": { "type": "string" }, "message": { "type": "string" }, "link": { "type": "string" }, "subjectRich": { "type": "string" }, "subjectRichParameters": { "anyOf": [ { "type": "object", "properties": {} } ] }, "messageRich": { "type": "string" }, "messageRichParameters": { "anyOf": [ { "type": "object", "properties": {} } ] }, "icon": { "type": "string" }, "actions": { "type": "array", "items": { "$ref": "#/components/schemas/NotificationAction" } } } }, "NotificationAction": { "type": "object", "required": [ "label", "link", "type" ], "properties": { "label": { "type": "string" }, "link": { "type": "string" }, "type": { "type": "string" }, "primary": { "type": "boolean" } } }, "ListNotifications": { "type": "object", "required": [ "ocs" ], "properties": { "ocs": { "type": "object", "required": [ "meta", "data" ], "properties": { "meta": { "$ref": "#/components/schemas/OCSMeta" }, "data": { "type": "array", "items": { "$ref": "#/components/schemas/Notification" } } } } } }, "GetNotification": { "type": "object", "required": [ "ocs" ], "properties": { "ocs": { "type": "object", "required": [ "meta", "data" ], "properties": { "meta": { "$ref": "#/components/schemas/OCSMeta" }, "data": { "$ref": "#/components/schemas/Notification" } } } } }, "PushServerSubscription": { "type": "object", "required": [ "publicKey", "deviceIdentifier", "signature" ], "properties": { "publicKey": { "type": "string" }, "deviceIdentifier": { "type": "string" }, "signature": { "type": "string" }, "message": { "type": "string" } } }, "PushServerRegistration": { "type": "object", "required": [ "ocs" ], "properties": { "ocs": { "type": "object", "required": [ "meta", "data" ], "properties": { "meta": { "$ref": "#/components/schemas/OCSMeta" }, "data": { "$ref": "#/components/schemas/PushServerSubscription" } } } } }, "PushNotification": { "type": "object", "required": [ "accountID", "priority", "type", "subject" ], "properties": { "accountID": { "type": "string" }, "priority": { "type": "string" }, "type": { "type": "string" }, "subject": { "$ref": "#/components/schemas/PushNotificationDecryptedSubject" } } }, "PushNotificationDecryptedSubject": { "type": "object", "properties": { "nid": { "type": "integer" }, "app": { "type": "string" }, "subject": { "type": "string" }, "type": { "type": "string" }, "id": { "type": "string" }, "delete": { "type": "boolean" }, "delete-all": { "type": "boolean" } } } }, "securitySchemes": { "basic_auth": { "type": "http", "scheme": "basic" } } }, "paths": { "/ocs/v2.php/apps/notifications/api/v2/notifications": { "get": { "operationId": "list-notifications", "tags": [ "notifications" ], "responses": { "200": { "description": "", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ListNotifications" } } } } } }, "delete": { "operationId": "delete-all-notifications", "tags": [ "notifications" ], "responses": { "200": { "description": "", "content": { "application/json": { "schema": { "type": "string" } } } } } } }, "/ocs/v2.php/apps/notifications/api/v2/notifications/{id}": { "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "integer" } } ], "get": { "operationId": "get-notification", "tags": [ "notifications" ], "responses": { "200": { "description": "", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/GetNotification" } } } } } }, "delete": { "operationId": "delete-notification", "tags": [ "notifications" ], "responses": { "200": { "description": "", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/EmptyOCS" } } } } } } }, "/ocs/v2.php/apps/notifications/api/v2/push": { "post": { "operationId": "register-device", "tags": [ "notifications" ], "parameters": [ { "name": "pushTokenHash", "in": "query", "required": true, "schema": { "type": "string" } }, { "name": "devicePublicKey", "in": "query", "required": true, "schema": { "type": "string" } }, { "name": "proxyServer", "in": "query", "required": true, "schema": { "type": "string" }, "description": "This URL has to end with a / otherwise the device will not be able to register" } ], "responses": { "201": { "description": "", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/PushServerRegistration" } } } } } }, "delete": { "operationId": "remove-device", "tags": [ "notifications" ], "responses": { "202": { "description": "", "content": { "application/json": { "schema": { "type": "string" } } } } } } }, "/ocs/v2.php/apps/notifications/api/v2/admin_notifications/{userId}": { "parameters": [ { "name": "userId", "in": "path", "required": true, "schema": { "type": "string" } } ], "post": { "operationId": "send-admin-notification", "tags": [ "notifications" ], "parameters": [ { "name": "shortMessage", "in": "query", "required": true, "schema": { "type": "string" } }, { "name": "longMessage", "in": "query", "required": false, "schema": { "type": "string", "default": "" } } ], "responses": { "200": { "description": "", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/EmptyOCS" } } } } } } } } }