diff --git a/lib/Controller/APIController.php b/lib/Controller/APIController.php index d3ff8352d..a950c2fbe 100644 --- a/lib/Controller/APIController.php +++ b/lib/Controller/APIController.php @@ -165,7 +165,7 @@ public function generateNotificationV3( * * Required capability: `ocs-endpoints > test-push` * - * @return DataResponse + * @return DataResponse|DataResponse * * 200: Test notification generated successfully, but the device should still show the message to the user * 400: Test notification could not be generated, show the message to the user @@ -208,6 +208,10 @@ public function selfTestPush(): DataResponse { $this->notificationApp->setOutput($output); $this->notificationManager->notify($notification); + + /** @var int $nid */ + $nid = $this->notificationApp->getLastInsertedId(); + return new DataResponse(['message' => $output->fetch(), 'nid' => $nid]); } catch (\InvalidArgumentException $e) { $this->logger->error('Self testing push notification failed: ' . $e->getMessage(), ['exception' => $e]); return new DataResponse( @@ -215,7 +219,5 @@ public function selfTestPush(): DataResponse { Http::STATUS_BAD_REQUEST, ); } - - return new DataResponse(['message' => $output->fetch()]); } } diff --git a/openapi-full.json b/openapi-full.json index 82c3fbc88..08ff7c7e3 100644 --- a/openapi-full.json +++ b/openapi-full.json @@ -1514,11 +1514,16 @@ "data": { "type": "object", "required": [ - "message" + "message", + "nid" ], "properties": { "message": { "type": "string" + }, + "nid": { + "type": "integer", + "format": "int64" } } } diff --git a/openapi-push.json b/openapi-push.json index 979e4838f..8fa8cc368 100644 --- a/openapi-push.json +++ b/openapi-push.json @@ -163,11 +163,16 @@ "data": { "type": "object", "required": [ - "message" + "message", + "nid" ], "properties": { "message": { "type": "string" + }, + "nid": { + "type": "integer", + "format": "int64" } } }