This site is no longer being maintained. Latest documents are available at Cisco Hosted Collaboration Solution. .

 

How to ... Test the HCS Assurance APIs with Curl

HCS Version tested: 9.0

CURL is a an open source, cross-platform tool able to perform URL-based network requests from the comamnd line: http://curl.haxx.se/

CURL can be used, among other things, to make HTTP requests, including SOAP requests. You can use curl to run a simple test of any of the HCS Assurance APIs.

In this example, we will call the getArchivedEvents API of the Prime Central for HCS Web Service. The XML for the actual SOAP request is stored in a file on the local system, called 'request.xml'. The session token value was retrieved previously by using the authenticate API. Here are the contents of the file:

request.xml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
<strong style="font:'Courier New', Courier, monospace; font-size:14px;">
<table class="tablesorter" cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td style="border-right-color:#6ce26c; border-right-width:thick; border-left-style: none; border-bottom-style:none; border-top-style:none "><span style="color:#999;">1</span>
<span style="color:#999;">2</span>
<span style="color:#999;">3</span>
<span style="color:#999;">4</span>
<span style="color:#999;">5</span>
<span style="color:#999;">6</span>
<span style="color:#999;">7</span>
<span style="color:#999;">8</span>
<span style="color:#999;">9</span>
</td>
<td style="border-right-style: none; border-left-style:none; border-bottom-style:none; border-top-style:none;"><<span style="color:#009;">soapenv:Envelope</span> <span style="color:#999;">xmlns:soapenv</span>=<span style="color:#09F;">"http://schemas.xmlsoap.org/soap/envelope/" </span> <span style="color:#999;">xmlns:fron</span>=<span style="color:#09F;">"http://fronthandler.hcm.cisco.com/"</span>>
<<span style="color:#009;">soapenv:Header</span>/>
<<span style="color:#009;">soapenv:Body</span>>
<<span style="color:#009;">fron:getArchivedEvents</span>>
<<span style="color:#009;">whereClause</span>>type=1</<span style="color:#009;">whereClause</span>>
<<span style="color:#009;">sessionToken</span>>session_563</<span style="color:#009;">sessionToken</span>>
</<span style="color:#009;">fron:getArchivedEvents</span>>
</<span style="color:#009;">soapenv:Body</span>>
</<span style="color:#009;">soapenv:Envelope</span>></td></tr></tbody></table></strong>

This XML could be replaced with any valid HCS Assurance API request XML.

The CURL command is executed in the same directory as the request.xml file.

1
2
3
4
5
6
7
<strong style="font:'Courier New', Courier, monospace; font-size:14px;">
<table class="tablesorter" cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td style="border-right-color:#6ce26c; border-right-width:thick; border-left-style: none; border-bottom-style:none; border-top-style:none "><span style="color:#999;">1</span>
</td>
<td style="border-right-style: none; border-left-style:none; border-bottom-style:none; border-top-style:none;">$ curl -k  -H <span style="color:#09F;">"Content-type: text/xml;"</span> -d @request.xml https://your-prime-central-server:9090/EventManagement</td></tr></tbody></table></strong>

The parameters given are as follows:

  • -k: Disable SSL key authentication of the AXL server
  • -H : Header. provided to override CURL's default Content-type
  • -d : Specifies the data file where the data to be sent is stored
  • The final parameter is the Prime Central for HCS Web Service URL, be sure to ensure the IP address is valid and includes the port designation :9090

After running the curl command at the command prompt, you should see a response similar to example below.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
<strong style="font:'Courier New', Courier, monospace; font-size:14px;">
<table class="tablesorter" cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td style="border-right-color:#6ce26c; border-right-width:thick; border-left-style: none; border-bottom-style:none; border-top-style:none "><span style="color:#999;">1</span>
<span style="color:#999;">2</span>
<span style="color:#999;">3</span>
<span style="color:#999;">4</span>
<span style="color:#999;">5</span>
<span style="color:#999;">6</span>
<span style="color:#999;">7</span>
<span style="color:#999;">8</span>
<span style="color:#999;">9</span>
<span style="color:#999;">10</span>
<span style="color:#999;">11</span>
<span style="color:#999;">12</span>
<span style="color:#999;">13</span>
<span style="color:#999;">14</span>
<span style="color:#999;">15</span>
<span style="color:#999;">16</span>
<span style="color:#999;">17</span>
<span style="color:#999;">18</span>
<span style="color:#999;">19</span>
<span style="color:#999;">20</span>
<span style="color:#999;">21</span>
<span style="color:#999;">22</span>
<span style="color:#999;">23</span>
<span style="color:#999;">24</span>
<span style="color:#999;">25</span>
<span style="color:#999;">26</span>
<span style="color:#999;">27</span>
<span style="color:#999;">28</span>
<span style="color:#999;">29</span>
<span style="color:#999;">30</span>
<span style="color:#999;">31</span>
<span style="color:#999;">32</span>
<span style="color:#999;">33</span>
<span style="color:#999;">34</span>
<span style="color:#999;">35</span>
<span style="color:#999;">36</span>
<span style="color:#999;">37</span>
<span style="color:#999;">38</span>
</td>
<td style="border-right-style: none; border-left-style:none; border-bottom-style:none; border-top-style:none;"><<span style="color:#009;">soap:Envelope</span> <span style="color:#999;">xmlns:soap</span>=<span style="color:#09F;">"http://schemas.xmlsoap.org/soap/envelope/" </span>>
<<span style="color:#009;">soap:Body</span>
<<span style="color:#009;">ns2:getArchivedEventsResponse</span> <span style="color:#999;">xmlns:ns2</span>=<span style="color:#09F;">"http://fronthandler.hcm.cisco.com/"</span>>
<<span style="color:#009;">return</span>>
<<span style="color:#009;">causeType</span>>0</<span style="color:#009;">causeType</span>>
<<span style="color:#009;">componentId</span>>java</<span style="color:#009;">componentId</span>>
<<span style="color:#009;">count</span>>1</<span style="color:#009;">count</span>>
<<span style="color:#009;">deviceID</span>>im</<span style="color:#009;">deviceID</span>>
<<span style="color:#009;">domainManagerID</span>>your server</<span style="color:#009;">domainManagerID</span>>
<<span style="color:#009;">eventIdentifier</span>>NCOMS_144</<span style="color:#009;">eventIdentifier</span>>
<<span style="color:#009;">eventName</span>>Linux_Process_High_Cpu</<span style="color:#009;">eventName</span>>
<<span style="color:#009;">eventStatus</span>>1</<span style="color:#009;">eventStatus</span>>
<<span style="color:#009;">firstOccurence</span>>2013-02-18 12:41:03.0</<span style="color:#009;">firstOccurence</span>>
<<span style="color:#009;">lastOccurence</span>>2013-02-18 12:41:03.0</<span style="color:#009;">lastOccurence</span>>
<<span style="color:#009;">operationalDataPointer</span>>https://your server:8443/EventEnrichment/getOperationalData?eventName=Linux_Process_High_Cpu</<span style="color:#009;">operationalDataPointer</span>>
<<span style="color:#009;">originalSeverity</span>>Warning(2)</<span style="color:#009;">originalSeverity</span>>
<<span style="color:#009;">severity</span>>0</<span style="color:#009;">severity</span>>
<<span style="color:#009;">summary</span>>Linux_Process_High_Cpu[(Busy_CPU_Pct>60.00 ) ON im:LZ ON java (Busy_CPU_Pct=100.00 )]</<span style="color:#009;">summary</span>>
</<span style="color:#009;">return</span>>
<<span style="color:#009;">return</span>>
<<span style="color:#009;">causeType</span>>0</<span style="color:#009;">causeType</span>>
<<span style="color:#009;">componentId</span>>java</<span style="color:#009;">componentId</span>>
<<span style="color:#009;">count</span>>1</<span style="color:#009;">count</span>>
<<span style="color:#009;">deviceID</span>>im</<span style="color:#009;">deviceID</span>>
<<span style="color:#009;">domainManagerID</span>>your server</<span style="color:#009;">domainManagerID</span>>
<<span style="color:#009;">eventIdentifier</span>>NCOMS_146</<span style="color:#009;">eventIdentifier</span>>
<<span style="color:#009;">eventName</span>>Linux_Process_High_Cpu</<span style="color:#009;">eventName</span>>
<<span style="color:#009;">eventStatus</span>>1</<span style="color:#009;">eventStatus</span>>
<<span style="color:#009;">firstOccurence</span>>2013-02-18 13:26:03.0</<span style="color:#009;">firstOccurence</span>>
<<span style="color:#009;">lastOccurence</span>>2013-02-18 13:26:03.0</<span style="color:#009;">lastOccurence</span>>
<<span style="color:#009;">operationalDataPointer</span>>https://your server:8443/EventEnrichment/getOperationalData?eventName=Linux_Process_High_Cpu</<span style="color:#009;">operationalDataPointer</span>>
<<span style="color:#009;">originalSeverity</span>>Warning(2)</<span style="color:#009;">originalSeverity</span>>
<<span style="color:#009;">severity</span>>0</<span style="color:#009;">severity</span>>
<<span style="color:#009;">summary</span>>Linux_Process_High_Cpu[(Busy_CPU_Pct>60.00 ) ON im:LZ ON java (Busy_CPU_Pct=91.00 )]</<span style="color:#009;">summary</span>>
</<span style="color:#009;">return</span>>
</<span style="color:#009;">ns2:getArchivedEventsResponse</span>>
</<span style="color:#009;">soap:Body></span>
</<span style="color:#009;">soap:Envelope></span>
</td></tr></tbody></table></strong>