Getting information about current subscribers and subscriptions
To get information about the subscribers receiving notifications from a switch, you must use the REST API.
Instructions and examples in this document use an IP address that is reserved for documentation, 192.0.2.5, as an example of the IP address for the switch. To access your switch, you must use the IP address or hostname of that switch.
You must be logged in to the switch REST API.
-
To get the list of current subscribers, send a GET request to the
notification_subscribers
resource.For example:
GET "https://192.0.2.5/rest/v1/system/notification_subscribers"
The response body is a list of URIs. The identifier at the end of the URI string is the subscriber name.
For example:
[ "rest/v1/system/notification_subscribers/z6901beisjgf", "rest/v1/system/notification_subscribers/18l9g87erb42" ]
-
To get a list of all subscriptions of all subscribers, use the
depth=2
parameter when sending the GET request to thenotification_subscribers
resource.For example:
GET "https://192.0.2.5/rest/v1/system/notification_subscribers?depth=2"
The response body contains the list of subscriptions for each subscriber.
In the following example,
Subscriber
z6901beisjgf
has two subscriptions:5mzo50lgoo
pouswxt9m9
Subscriber
18l9g87erb42
has one subscription:dz95lljqwk
[ { "name": "z6901beisjgf", "notification_subscriptions": { "5mzo50lgoo": "rest/v1/system/notification_subscribers/z6901beisjgf/notification_subscriptions/5mzo50lgoo", "pouswxt9m9": "rest/v1/system/notification_subscribers/z6901beisjgf/notification_subscriptions/pouswxt9m9" }, "type": "ws" }, { "name": "18l9g87erb42", "notification_subscriptions": { "dz95lljqwk": "rest/v1/system/notification_subscribers/18l9g87erb42/notification_subscriptions/dz95lljqwk" }, "type": "ws" } ]
-
To get detailed information about all subscriptions of all subscribers, use the
depth=2
parameter when sending the GET request to thenotification_subscribers
resource.For example:
GET "https://192.0.2.5/rest/v1/system/notification_subscribers?depth=2"
-
To get a list of subscriptions that belong to a specific subscriber, send a GET request to the
notification_subscriptions
resource of the subscriber.The following example gets the list of all the subscriptions of subscriber
z6901beisjgf
:GET "https://192.0.2.5/rest/v1/system/notification_subscribers/z6901beisjgf/notification_subscriptions"
The response body is a list of URIs. The identifier at the end of the URI string is the subscription name.
Example response body:
[ "rest/v1/system/notification_subscribers/z6901beisjgf/notification_subscriptions/5mzo50lgoo", "rest/v1/system/notification_subscribers/z6901beisjgf/notification_subscriptions/pouswxt9m9" ]
-
To get detailed information about a specific subscription, send a GET request to the
notification_subscriptions/{subscription-ID}
resource for that subscription.The
notification_subscriptions
resource is a child resource of the specific subscriber:/system/notification_subscribers/{subscriber-id}/notification_subscriptions/{subscription-id}
For example, to get information about subscription
5mzo50lgoo
, you must specify the subscriber name and the subscription name in the URI:GET "https://192.0.2.5/rest/v1/system/notification_subscribers/z6901beisjgf/notification_subscriptions/pouswxt9m9"
Example response body:
{ "5mzo50lgoo": { "resource": [ "/rest/v1/system/ports?attributes=admin,vlan_mode,vlan_tag,vlan_trunks,interfaces&depth=1" ] } }
-
To get detailed information about all subscriptions of specific subscriber, use the
depth=1
parameter when sending the GET request to thenotification_subscriptions
resource of that subscriber.For example:
GET "https://192.0.2.5/rest/v1/system/notification_subscribers/z6901beisjgf/notification_subscriptions?depth=2"
Example response body:
{ "5mzo50lgoo": { "resource": [ "/rest/v1/system/ports?attributes=admin,vlan_mode,vlan_tag,vlan_trunks,interfaces&depth=1" ] }, "pouswxt9m9": { "resource": [ "/rest/v1/system/interfaces?attributes=type,hw_intf_info,link_state,link_speed,error,other_config" ] } }