Notifications - Only subscribed to events API but receiving other types

Hi all, I’m using a hosted c8y environment. Using the Notifications 2.0 API with Websockets.

Here is the response from: {{baseUrl}}/notification2/subscriptions?pageSize=50

{
    "next": "https://XYZ.machines.cloud/notification2/subscriptions?pageSize=50&currentPage=2",
    "subscriptions": [
        {
            "nonPersistent": false,
            "context": "mo",
            "self": "https://XYZ.machines.cloud/notification2/subscriptions/11111111111",
            "subscription": "SubEvents",
            "id": "11111111111",
            "source": {
                "self": "https://XYZ.machines.cloud/inventory/managedObjects/222222222",
                "id": "222222222"
            },
            "filter": {
                "apis": [
                    "events"
                ]
            }
        }
    ],
    "self": "https://XYZ.machines.cloud/notification2/subscriptions?pageSize=50&currentPage=1",
    "statistics": {
        "pageSize": 50,
        "currentPage": 1
    }
,

As you can see from the subscriptions API responses, I’m only subscribed to “events” I’m getting messages sent from:

/XYZ/events/222222222

{"lastUpdated":"2024-11-20T12:08:36.446Z","creationTime":"2024-11-20T12:08:36.446Z","self":"https://XYZ.machines.cloud/event/events/11111111","id":"11111111","source":{"name":"NAME","self":"https://XYZ.machines.cloud/inventory/managedObjects/222222222","id":"222222222"},"text":"rgLocUpdate","time":"2024-11-20T12:08:29.000Z","type":"c8y_LocationUpdate","c8y_Position":{"lng":3.597217,"lat":51.445541,"heading":0,"rgOpState":0},"rgData":{"SOG":{"value":0,"unit":"knts"},"Eng Speed PT":{"value":0,"unit":"rpm"},"Eng Speed STB":{"value":0,"unit":"rpm"}}}

/XYZ/eventsWithChildren/222222222

{"lastUpdated":"2024-11-20T11:49:48.657Z","creationTime":"2024-11-20T11:49:48.657Z","self":"https://XYZ.machines.cloud/event/events/333333333","id":"333333333","text":"rgLocUpdate","source":{"name":"Asset 2","self":"https://XYZ.machines.cloud/inventory/managedObjects/222222222","id":"222222222"},"time":"2024-11-20T11:49:44.000Z","type":"c8y_LocationUpdate","c8y_Position":{"lng":-2.086799,"lat":55.874016,"heading":339,"rgOpState":0},"rgData":{"SOG":{"value":0,"unit":"knts"},"Eng Speed PT":{"value":0,"unit":"rpm"},"Eng Speed STB":{"value":0,"unit":"rpm"}}}

/XYZ/measurements/222222222

{"self":"https://XYZ.machines.cloud/measurement/measurements/44444444","time":"2024-11-20T11:49:10.835Z","id":"44444444","source":{"self":"https://XYZ.machines.cloud/inventory/managedObjects/222222222","id":"222222222"},"type":"DLValues","DLValues":{..}}

/XYZ/managedobjects/222222222

{
   "additionParents":{
      "references":[
        
      ],
      "self":"https://XYZ.machines.cloud/inventory/managedObjects/222222222/additionParents"
   },
   "owner":"device_TCG4-203670701009",
   "childDevices":{
      "references":[
         
      ],
      "self":"https://XYZ.machines.cloud/inventory/managedObjects/222222222/childDevices"
   },
   "childAssets":{
      "references":[
         
      ],
      "self":"https://XYZ.machines.cloud/inventory/managedObjects/222222222/childAssets"
   },
   "creationTime":"2020-09-18T12:39:49.238Z",
   "type":"onboard unit",
   "lastUpdated":"2024-11-20T11:58:31.948Z",
   "childAdditions":{
      "references":[
         {
            "managedObject":{
               "self":"https://XYZ.machines.cloud/inventory/managedObjects/5555555555",
               "id":"5555555555"
            },
            "self":"https://XYZ.machines.cloud/inventory/managedObjects/222222222/childAdditions/5555555555"
         },
         {
            "managedObject":{
               "self":"https://XYZ.machines.cloud/inventory/managedObjects/66666666666",
               "id":"66666666666"
            },
            "self":"https://XYZ.machines.cloud/inventory/managedObjects/222222222/childAdditions/66666666666"
         }
      ],
      "self":"https://XYZ.machines.cloud/inventory/managedObjects/222222222/childAdditions"
   },
   "name":"NAME",
   "assetParents":{
      "references":[
         
      ],
      "self":"https://XYZ.machines.cloud/inventory/managedObjects/222222222/assetParents"
   },
   "deviceParents":{
      "references":[
         
      ],
      "self":"https://XYZ.machines.cloud/inventory/managedObjects/222222222/deviceParents"
   },
   "self":"https://XYZ.machines.cloud/inventory/managedObjects/222222222",
   "id":"222222222",
   "c8y_Firmware":{
      "name":"Last update: geofences",
      "version":"79"
   },
   "c8y_Availability":{
      "lastMessage":"2024-11-20T11:53:59.195Z",
      "status":"AVAILABLE"
   },
   "com_cumulocity_model_Agent":{
      
   },
   "c8y_Connection":{
      "status":"CONNECTED"
   },
   "c8y_RequiredAvailability":{
      "responseInterval":6
   },
   "c8y_SupportedOperations":[
      "c8y_Restart",
      "c8y_Command",
      "c8y_Firmware",
      "c8y_CellInfo",
      "c8y_SignalStrength",
      "c8y_RequiredAvailability"
   ],
   "c8y_Position":{
    "...":""
   },
   "c8y_TrackerOn":true,
   "c8y_Hardware":{
     "...":""
   },
   "c8y_TrackerDuration":18,
   "c8y_Software":{
   "...":""
   },
   "c8y_Mobile":{
    "...":""
   },
   "c8y_ActiveAlarmsStatus":{
      "minor":0,
      "major":0,
      "critical":0,
      "warning":0
   },
   "c8y_IsDevice":{
      "...":""
   },
   "c8y_VpnInfo":{
    "...":""
   },
   "c8y_Command":{
      "...":""
   },
   "c8y_Restart":{
     "...":"" 
   },
   "c8y_MotionTracking":{
      "active":true
   },
   "c8y_DataPoint":{
     "...":""
   }
}

Is this normal?

Regards
Sharry

Hi Sharry,

The filter field in your request is incorrect. It should be updated to subscriptionFilter as shown below:

{
    ...
    "subscriptionFilter": {
        "apis": [
            "events"
        ]
    }
}

Kindly refer to the OpenAPI documentation for more details.

Let us know if this helps.

Regards,
Rohit

i got this in response to the ‘TY’ i sent replying to you earlier

We’re sorry, but your email message to [“incoming+b29aa57336a361d49c56b2b573c2b5a8@techcommunity.discoursemail.com”] (titled Re: Notifications - Only subscribed to events API but receiving other types) didn’t work.

To promote more in depth conversations, very short replies are not allowed. Can you please reply with at least 12 characters? Alternatively, you can like a post via email by replying with “+1”.

 {
            "nonPersistent": false,
            "subscriptionFilter": {
                "apis": [
                    "measurements"
                ]
            },
            "context": "mo",
            "self": "url",
            "subscription": "subName",
            "id": "26514699",
            "source": {
                "self": "url",
                "id": "444893245"
            }
        }

Here is a sample subscription in my tenant that works. Please delete your subscription and create a new one using the correct request body from the open API docs.Preformatted text

Hi all, I haven’t posted the request code. This is the responses from when I list my created subscriptions.


UPDATE: Sorry, just realised what you are saying. Thanks I’ll try that