Platform info:
- Frontend: 1018.503.106
- Backend: 1018.540.195
Hosted env on https://XYZ.machines.cloud
I’m writing an application in C# that uses the Notifications API 2.0. I have the role ROLE_NOTIFICATION_2_ADMIN against my user. I’m also using POSTMAN to test these requests.
I’m creating a subscription (POST /notification2/subscriptions) that subscribes to all APIs & has no filters or fragmentsToCopy as I want to narrow it down later on.
{
"context": "mo",
"subscription": "{{SubscriptionName}}",
"source": {
"id": "{{managedObjectId}}"
},
"subscriptionFilter": {
"apis": [ "*" ]
},
"nonPersistent": false
}
After that I creation a Token (POST /notification2/token)
{
"subscriber": "UniqueNotifications",
"subscription": "{{SubscriptionName}}",
"expiresInMinutes": 1440,
"type": "notification",
"signed": true,
"shared": false,
"nonPersistent": false
}
Once I get the token from the response, I connect to the Websocket: wss://XYZ.machines.cloud/notification2/consumer/?token={{token}}&consumer=postman
I have have extras like a heartbeat which keeps the connection alive & not just the normal 5 mins of inactivity. On close, it unsubscribes & deletes the subscription etc.
Ignoring the c# code for the time being, I’m using POSTMAN. I’m getting a connected:
I’ve also created a simulator for the position / events:
I’ve even tried via POSTMAN to create events & alarms
eg:
POST /event/events
{
"source": {
"id": "{{managedObjectId}}"
},
"type": "c8y_Sharry",
"text": "Sharry event testing",
"time": "2024-11-13T11:05:27.845Z"
}
POST /alarm/alarms
{
"source": {
"id": "{{managedObjectId}}"
},
"type": "c8y_Sharry",
"text": "Sharry WARNING testing",
"severity": "WARNING",
"time": "2024-11-13T10:05:27.845Z",
"status": "ACTIVE"
}
No matter what I do whether enabling the simulator or sending events via the API on POSTMAN, nothing appears in the application console or POSTMAN console.
Any help greatly appreciated.
Sharry