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

 

How to ... Test the HCS Fulfillment 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 Fulfillment APIs.

In this example, we will call the getListOfApplicationInstances API of the SharedData Repository Web Service. The XML for the actual HCS API SOAP request is stored in a file on the local system, called 'request.xml' 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
<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>
</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:v9=</span><span style="color:#09F;">"http://v9_0.sdr.ws.nbi.hcs.cisco.com/"</span>>
<<span style="color:#009;">soapenv:Header</span>/>
<<span style="color:#009;">soapenv:Body</span>>
<<span style="color:#009;">v9:getListOfApplicationInstances</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 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 -u {your HCS Username} -H <span style="color:#09F;">"Content-type: text/xml;"</span> -d @request.xml https://{your-hcs-server}:8443/HCSWebServiceInterface/v9_0/SharedDataRepositoryWebService</td></tr></tbody></table></strong>

The parameters given are as follows:

  • -k : Disable SSL key authentication of the AXL server
  • -u : The username used for Basic HTTP authentication. This should be a HCS admin user.
  • -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 HCS Web Service URL, be sure to ensure the IP address is valid and includes the port designation :8443

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
<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>
</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;">ns3:getListOfApplicationInstancesResponse</span> <span style="color:#999;"> xmlns:ns5</span>=<span style="color:#09F;">"exception.common.hcs.cisco.com"</span> <span style="color:#999;"> xmlns:ns4</span>=<span style="color:#09F;">"dto.v9_0.sdr.ws.nbi.hcs.cisco.com"</span><span style="color:#999;">  xmlns:ns3</span> <span style="color:#09F;">"http://v9_0.sdr.ws.nbi.hcs.cisco.com/"</span>  <span style="color:#999;"> xmlns:ns2</span><span style="color:#09F;">"sdr.ws.nbi.hcs.cisco.com"</span>>
<<span style="color:#009;">return</span>>
<<span style="color:#009;">cdmUpdateTimestamp</span>>2013-02-08 14:50:46.338392</<span style="color:#009;">cdmUpdateTimestamp</span>>
<<span style="color:#009;">isDeletable</span>>false</<span style="color:#009;">isDeletable</span>>
<<span style="color:#009;">isModifiable</span>>true</<span style="color:#009;">isModifiable</span>>
<<span style="color:#009;">pk</span>>
<<span style="color:#009;">value</span>>1</<span style="color:#009;">value</span>>
</<span style="color:#009;">pk</span>>
<<span style="color:#009;">name</span>>HCM-F</<span style="color:#009;">name</span>>
</<span style="color:#009;">return</span>>
<<span style="color:#009;">return</span>>
<<span style="color:#009;">cdmUpdateTimestamp</span>>2013-02-14 13:06:52.63715</<span style="color:#009;">cdmUpdateTimestamp</span>>
<<span style="color:#009;">isDeletable</span>>true</<span style="color:#009;">isDeletable</span>>
<<span style="color:#009;">isModifiable</span>>true</<span style="color:#009;">isModifiable</span>>
</<span style="color:#009;">pk</span>>
<<span style="color:#009;">value</span>>1</<span style="color:#009;">value</span>>
</<span style="color:#009;">pk</span>>
<<span style="color:#009;">name</span>>vm-rtphcs-voss</<span style="color:#009;">name</span>>
</<span style="color:#009;">return</span>>
</<span style="color:#009;">ns3:getListOfApplicationInstancesResponse</span>>
</<span style="color:#009;">soap:Body</span>>
</<span style="color:#009;">soap:Envelope</span>></td></tr></tbody></table></strong>