ironmansoftware / powershell-universal

Issue tracker for PowerShell Universal
https://powershelluniversal.com
34 stars 2 forks source link

POST /api/v1/notification #3462

Closed ADFuji closed 1 month ago

ADFuji commented 1 month ago

Version

4.3.0

Severity

Low

Environment

msi

Steps to Reproduce

I'm trying to use the /api/v1/notification endpoint with the POST method to create notifications in my admin panel. However, the endpoint doesn't seem to be working...

GET /api/v1/notification returns notifications correctly: Example:

{
    "id": 1594,
    "title": "Invalid configuration: C:\\ProgramData\\UniversalAutomation\\Repository\\.universal\\roles.ps1",
    "description": "Cannot bind argument to parameter 'ClaimValue' because it is an empty string.",
    "createdTime": "2024-07-16T15:13:39.4567132Z",
    "createdBy": null,
    "job": null,
    "script": null,
    "dashboard": null,
    "license": null,
    "identity": null,
    "level": 2,
    "viewed": false
}

But when I try to create one with this body:

{
    "id": 15930,
    "title": "Invalid configuration: C:\\ProgramData\\UniversalAutomation\\Repository\\.universal\\roles.ps1",
    "description": "Cannot bind argument to parameter 'ClaimValue' because it is an empty string.",
    "createdTime": "2024-07-16T15:13:39.4567132Z",
    "createdBy": null,
    "job": null,
    "script": null,
    "dashboard": null,
    "license": null,
    "identity": null,
    "level": 2,
    "viewed": false
}

I get the following error: Object reference not set to an instance of an object.

When I try to use an already used id, I get this message: notification with that id: 1594 already exists, a unique id is required.

Expected behavior

Status 200

Actual behavior

Status: 500
Message : Object reference not set to an instance of an object.

Additional Environment data

No response

Screenshots/Animations

No response

JessePeden commented 1 month ago

Wow. That was fast.

adamdriscoll commented 1 month ago

Luckily an easy fix!

ADFuji commented 1 month ago

Thanks !!!!

mikedhanson commented 1 month ago

@adamdriscoll should this just be a cmdlet? new-psunotification