Cisco Cisco Evolved Programmable Network Manager 2.0 Developer's Guide

Page of 204
  
 
 
 
Cisco Evolved Programmable Network Manager 2.0.1 RESTCONF API Guide 
 
 
196 
 
8.4  Connectionless Notifications 
The following is the workflow in the case of "connectionless" notifications: 
 
The user is expected to a REST webservice that is capable of accepting XML and/ or 
JSON payloads as a POST request. This REST service is the endpoint to which the 
Cisco EPN Manager restconf notifications framework publishes notifications to. 
 
User subscribes to notifications by providing the REST service endpoint along with 
the topic to subscribe to. In this case, the topic will be "inventory" 
o  URL: https://{server}/restconf/data/v1/cisco-notifications:subscription 
o  Method: POST 
o  Authentication: Basic Authentication 
o  Example Payload
 
 
<
ns1:notification-subscription
 
xmlns:ns1
=
"urn:cisco:params:xml:ns:yang:yang-push:v1"
>
 
    
<
ns1:endpoint-url
>
http://{server}:{port}/{context}
</
ns1:endpoint-url
>
 
    
<
ns1:topic
>
{topic}
</
ns1:topic
>
 
</
ns1:notification-subscription
 
where,  
 
the endpoint-url is a REST service capable of accepting XML or JSON 
payloads as a POST request deployed in {server} at {port} using 
{context}. The notifications are then sent as POST payload to this 
endpoint-url. The REST service can then handle the notifications 
from the incoming POST message in any way that is desired. 
 
{topic} can be either "inventory", "service-activation" or "ha" 
 
There can be any number of subscriptions to the same type of notification. 
 
To get the list of notifications that the current user has access to, the following 
request can be used: 
o  URL: https:// {server}/restconf/data/v1/cisco-notifications:subscription 
o  Method: GET 
o  Authentication: Basic Authentication 
o  NOTE: "root" user can see subscriptions made by any user while any non-
root user can see only notification details that they subscribed to. 
 
<
ns2:response-message
 
xmlns:ns1
=
"urn:cisco:params:xml:ns:yang:yang-push:v1"
 
xmlns:ns2
=
"urn:cisco:params:xml:ns:yang:nrf-common:v1"
 
>
 
    
<
ns2:header
>
 
        
<
ns2:firstIndex
>
0
</
ns2:firstIndex
>
 
        
<
ns2:lastIndex
>
1
</
ns2:lastIndex
>
 
    
</
ns2:header
>
 
    
<
ns2:data
>
 
        
<
ns1:notification-subscription
>
 
            
<
ns1:subscription-id
>
8728688067781288015
</
ns1:subscription-id
>
 
            
<
ns1:subscribed-user
>
root
</
ns1:subscribed-user
>
 
            
<
ns1:endpoint-url
>
http://{server}:{port}/{context}
</
ns1:endpoint-url
>
 
            
<
ns1:topic
>
inventory
</
ns1:topic
>
 
            
<
ns1:creation-time
>
Tue May 31 13:46:57 PDT 2016
</
ns1:creation-time
>
 
            
<
ns1:time-of-update
>
Tue May 31 13:46:57 PDT 2016
</
ns1:time-of-update
>
 
        
</
ns1:notification-subscription
>