# Genesys Quality Management Suite 8.1.520 : Pause/Resume Web API cURL Examples

## cURL Examples

The following samples demonstrate this procedure in practice using the cURL tool.
To reproduce these calls, ensure that for the `curl` commands displayed, you update the `login` and `password` parameter values with the credentials of a user you have created solely for API purposes, with at least Pause and Resume Calls and Call List permissions. You will also need to replace the `myserver` hostname with the resolvable hostname of your Genesys Quality Management Suite server running the Core service and Tomcat web server.

## Log in to Pause/Resume API

    curl -v -b cookies.txt -c cookies.txt -X POST -d "login=admin&password=Password" myserver/callrec/loginAction.do
    * About to connect() to myserver port 80
    * Trying 192.168.1.2... connected
    * Connected to myserver (192.168.1.2) port 80
    > POST /callrec/loginAction.do HTTP/1.1
    > User-Agent: curl/7.15.5 (i686-redhat-linux-gnu) libcurl/7.15.5 OpenSSL/0.9.8b zlib/1.2.3 libidn/0.6.5
    > Host: myserver
    > Accept: */*
    > Cookie: JSESSIONID=2B80FC14142D6A6F64D75EA323FC9AA0
    > Content-Length: 29
    > Content-Type: application/x-www-form-urlencoded
    > > login=admin&password=Password
    HTTP/1.1 200 OK
    < Server: Apache-Coyote/1.1
    < Content-Type: text/html
    < Content-Length: 2779
    < Date: Wed, 25 Apr 2012 07:14:37 GMT <html>
    <head> <link rel="SHORTCUT ICON" href="favicon.ico"/> <title>ZOOM Call Recording 4.7.6, build: 111110_0145 | myserver</title>
    </head> <script type="text/javascript">
    <!-- JavaScript removed for clarity -->
    </script> <frameset id='frameset_main' rows="0px,81px,*,0px"> <frame name="audio" src="copyright.html" scrolling="no" frameborder="no" noresize="noresize"> <frame name="main_menu" src="menu_reccall.jsp" scrolling="no" noresize="noresize" frameborder="no"> <frameset id='frameset_middle_row' cols="*,0px"> <frame name="main" src="filteroperation?view_type=couple" frameborder="no" scrolling="yes" noresize="noresize"> <frame name="search" src="filters.jsp" frameborder="no" scrolling="yes" noresize="noresize"> </frameset> <frame name="copyright" src="copyright.html" scrolling="no" noresize="noresize" frameborder="no">
    </frameset> </html>
    * Connection #0 to host myserver left intact
    * Closing connection #0

Important: For clarity, the following examples omit this mandatory step to log in to the Pause/Resume API.

## List of Calls in Progress

    curl -v -b cookies.txt -c cookies.txt -G myserver/callrec/restful/couples.xml
    * About to connect() to myserver port 80
    * Trying 192.168.1.2... connected
    * Connected to myserver (192.168.1.2) port 80
    > GET /callrec/restful/couples.xml HTTP/1.1
    > User-Agent: curl/7.15.5 (i686-redhat-linux-gnu) libcurl/7.15.5 OpenSSL/0.9.8b zlib/1.2.3 libidn/0.6.5
    > Host: myserver
    > Accept: */*
    > Cookie: JSESSIONID=415DC8389E8F276EF9C12EB25F07463E
    > < HTTP/1.1 403 Forbidden
    < Server: Apache-Coyote/1.1
    < Content-Type: text/html;charset=utf-8
    < Content-Length: 991
    < Date: Wed, 25 Apr 2012 14:50:38 GMT
    <html><head><title>Apache Tomcat/6.0.24 - Error report</title><style><!--H1 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;} H2 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;} H3 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;} BODY {font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;} B {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;} P {font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;}A {color : black;}A.name {color : black;}HR {color : #525D76;}--></style> </head><body><h1>HTTP Status 403 - Forbidden</h1><HR size="1" noshade="noshade"><p><b>type</b> Status report</p><p><b>message</b> <u>Forbidden</u></p><p><b>description</b> <u>Access to the specified resource (Forbidden) has been forbidden.</u></p><HR size="1" noshade="noshade"><h3>Apache Tomcat/6.0.24</h3></body></html>
    Connection #0 to host myserver left intact
    * Closing connection #0

The following examples show various methods of specifying calls in progress.

## No Filter - No Calls in Progress

    curl -v -b cookies.txt -c cookies.txt -X GET myserver/callrec/restful/couples.xml
    * About to connect() to myserver port 80
    * Trying 192.168.1.2... connected
    * Connected to myserver (192.168.1.2) port 80
    > GET /callrec/restful/couples.xml HTTP/1.1
    > User-Agent: curl/7.15.5 (i686-redhat-linux-gnu) libcurl/7.15.5 OpenSSL/0.9.8b zlib/1.2.3 libidn/0.6.5
    > Host: myserver
    > Accept: */*
    > Cookie: JSESSIONID=FC1218F4EE0A64706EC3E9A96ED1AE62
    > < HTTP/1.1 200 OK
    < Server: Apache-Coyote/1.1
    < Cache-Control: no-cache, no-transform
    < Expires: Wed, 25 Apr 2012 11:31:13 GMT
    < Content-Type: application/xml
    < Content-Length: 105
    < Date: Wed, 25 Apr 2012 11:31:13 GMT
    <?xml version="1.0" encoding="UTF-8" standalone="yes"?><couples xmlns:ns2="http://www.w3.org/2005/Atom"/>
    Connection #0 to host myserver left intact
    * Closing connection #0

## No Filter - One Call in Progress

     curl -v -b cookies.txt -c cookies.txt -G myserver/callrec/restful/couples.xml
    * About to connect() to myserver port 80
    * Trying 192.168.1.2... connected
    * Connected to myserver (192.168.1.2) port 80
    > GET /callrec/restful/couples.xml HTTP/1.1
    > User-Agent: curl/7.15.5 (i686-redhat-linux-gnu) libcurl/7.15.5 OpenSSL/0.9.8b zlib/1.2.3 libidn/0.6.5
    > Host: myserver
    > Accept: */*
    > Cookie: JSESSIONID=FC1218F4EE0A64706EC3E9A96ED1AE62
    > < HTTP/1.1 200 OK
    < Server: Apache-Coyote/1.1
    < Cache-Control: no-cache, no-transform
    < Expires: Wed, 25 Apr 2012 12:06:57 GMT
    < Content-Type: application/xml
    < Content-Length: 364
    < Date: Wed, 25 Apr 2012 12:06:58 GMT
    <?xml version="1.0" encoding="UTF-8" standalone="yes"?><couples xmlns:ns2="http://www.w3.org/2005/Atom"><couples id="5" callId="5"><ns2:link type="application/xml" href="http://myserver/callrec/restful/couples.xml/5" rel="self"/><from>5688</from><paused>false</paused><start>2012-04-25T13:58:25.985+02:00</start><to>5680</to></couples></couples>
    Connection #0 to host myserver left intact
    * Closing connection #0

## Filter for Phone Number - One Call in Progress

    curl -v -b cookies.txt -c cookies.txt -G -d "phoneNumber=5680&phoneNumberDirection=BOTH" myserver/callrec/restful/couples.xml
    * About to connect() to myserver port 80
    * Trying 192.168.1.2... connected
    * Connected to myserver (192.168.1.2) port 80
    > GET /callrec/restful/couples.xml?phoneNumber=5680&phoneNumberDirection=BOTH HTTP/1.1
    > User-Agent: curl/7.15.5 (i686-redhat-linux-gnu) libcurl/7.15.5 OpenSSL/0.9.8b zlib/1.2.3 libidn/0.6.5
    > Host: myserver
    > Accept: */*
    > Cookie: JSESSIONID=FC1218F4EE0A64706EC3E9A96ED1AE62
    > < HTTP/1.1 200 OK
    < Server: Apache-Coyote/1.1
    < Cache-Control: no-cache, no-transform
    < Expires: Wed, 25 Apr 2012 12:06:25 GMT
    < Content-Type: application/xml
    < Content-Length: 364
    < Date: Wed, 25 Apr 2012 12:06:25 GMT
    <?xml version="1.0" encoding="UTF-8" standalone="yes"?><couples xmlns:ns2="http://www.w3.org/2005/Atom"><couples id="5" callId="5"><ns2:link type="application/xml" href="http://myserver/callrec/restful/couples.xml/5" rel="self"/><from>5688</from><paused>false</paused><start>2012-04-25T13:58:25.985+02:00</start><to>5680</to></couples></couples>
    Connection #0 to host myserver left intact
    * Closing connection #0

## Get Call Details - Active Call

    curl -v -b cookies.txt -c cookies.txt -G myserver/callrec/restful/couples.xml/5
    * About to connect() to myserver port 80
    * Trying 192.168.1.2... connected
    * Connected to myserver (192.168.1.2) port 80
    > GET /callrec/restful/couples.xml/5 HTTP/1.1
    > User-Agent: curl/7.15.5 (i686-redhat-linux-gnu) libcurl/7.15.5 OpenSSL/0.9.8b zlib/1.2.3 libidn/0.6.5
    > Host: myserver
    > Accept: */*
    > Cookie: JSESSIONID=FC1218F4EE0A64706EC3E9A96ED1AE62
    > < HTTP/1.1 200 OK
    < Server: Apache-Coyote/1.1
    < Cache-Control: no-cache, no-transform
    < Expires: Wed, 25 Apr 2012 12:24:44 GMT
    < Content-Type: application/xml
    < Content-Length: 479
    < Date: Wed, 25 Apr 2012 12:24:44 GMT
    <?xml version="1.0" encoding="UTF-8" standalone="yes"?><couple xmlns:ns2="http://www.w3.org/2005/Atom" id="5" callId="5"><ns2:link type="application/xml" href="http://myserver/callrec/restful/couples.xml/5" rel="self"/><ns2:link type="application/xml" href="http://myserver/callrec/restful/couples.xml/5/pausedState" rel="pause/resume"/><from>5688</from><paused>false</paused><start>2012-04-25T13:58:25.985+02:00</start><to>5680</to></couple>
    Connection #0 to host myserver left intact
    * Closing connection #0

## Pause Selected Call

    curl -v -b cookies.txt -c cookies.txt -d "paused=true" -X PUT myserver/callrec/restful/couples.xml/5/pausedState
    * About to connect() to myserver port 80
    * Trying 192.168.1.2... connected
    * Connected to myserver (192.168.1.2) port 80
    > PUT /callrec/restful/couples.xml/5/pausedState HTTP/1.1
    > User-Agent: curl/7.15.5 (i686-redhat-linux-gnu) libcurl/7.15.5 OpenSSL/0.9.8b zlib/1.2.3 libidn/0.6.5
    > Host: myserver
    > Accept: */*
    > Cookie: JSESSIONID=FC1218F4EE0A64706EC3E9A96ED1AE62
    > Content-Length: 11
    > Content-Type: application/x-www-form-urlencoded
    > > paused=true
    HTTP/1.1 303 See Other
    < Server: Apache-Coyote/1.1
    < Location: http://myserver/callrec/restful/couples.xml/5/
    < Content-Length: 0
    < Date: Wed, 25 Apr 2012 12:23:47 GMT
    * Connection #0 to host myserver left intact
    * Closing connection #0

## Get Call Details - Paused Call

     curl -v -b cookies.txt -c cookies.txt -G myserver/callrec/restful/couples.xml/5
    * About to connect() to myserver port 80
    * Trying 192.168.1.2... connected
    * Connected to myserver (192.168.1.2) port 80
    > GET /callrec/restful/couples.xml/5 HTTP/1.1
    > User-Agent: curl/7.15.5 (i686-redhat-linux-gnu) libcurl/7.15.5 OpenSSL/0.9.8b zlib/1.2.3 libidn/0.6.5
    > Host: myserver
    > Accept: */*
    > Cookie: JSESSIONID=FC1218F4EE0A64706EC3E9A96ED1AE62
    > < HTTP/1.1 200 OK
    < Server: Apache-Coyote/1.1
    < Cache-Control: no-cache, no-transform
    < Expires: Wed, 25 Apr 2012 12:24:44 GMT
    < Content-Type: application/xml
    < Content-Length: 479
    < Date: Wed, 25 Apr 2012 12:24:44 GMT
    <?xml version="1.0" encoding="UTF-8" standalone="yes"?><couple xmlns:ns2="http://www.w3.org/2005/Atom" id="5" callId="5"><ns2:link type="application/xml" href="http://myserver/callrec/restful/couples.xml/5" rel="self"/><ns2:link type="application/xml" href="http://myserver/callrec/restful/couples.xml/5/pausedState" rel="pause/resume"/><from>5688</from><paused>true</paused><start>2012-04-25T13:58:25.985+02:00</start><to>5680</to></couple>
    Connection #0 to host myserver left intact
    * Closing connection #0

## Resume Selected Call

    curl -v -b cookies.txt -c cookies.txt -d "paused=false" -X PUT myserver/callrec/restful/couples.xml/5/pausedState
    * About to connect() to myserver port 80
    * Trying 192.168.1.2... connected
    * Connected to myserver (192.168.1.2) port 80
    > PUT /callrec/restful/couples.xml/5/pausedState HTTP/1.1
    > User-Agent: curl/7.15.5 (i686-redhat-linux-gnu) libcurl/7.15.5 OpenSSL/0.9.8b zlib/1.2.3 libidn/0.6.5
    > Host: myserver
    > Accept: */*
    > Cookie: JSESSIONID=FC1218F4EE0A64706EC3E9A96ED1AE62
    > Content-Length: 12
    > Content-Type: application/x-www-form-urlencoded
    > > paused=false
    HTTP/1.1 303 See Other
    < Server: Apache-Coyote/1.1
    < Location: http://myserver/callrec/restful/couples.xml/5/
    < Content-Length: 0
    < Date: Wed, 25 Apr 2012 12:25:40 GMT
    * Connection #0 to host myserver left intact
    * Closing connection #0

## Get Call Details – Resumed Call

     curl -v -b cookies.txt -c cookies.txt -G myserver/callrec/restful/couples.xml/5
    * About to connect() to myserver port 80
    * Trying 192.168.1.2... connected
    * Connected to myserver (192.168.1.2) port 80
    > GET /callrec/restful/couples.xml/5 HTTP/1.1
    > User-Agent: curl/7.15.5 (i686-redhat-linux-gnu) libcurl/7.15.5 OpenSSL/0.9.8b zlib/1.2.3 libidn/0.6.5
    > Host: myserver
    > Accept: */*
    > Cookie: JSESSIONID=FC1218F4EE0A64706EC3E9A96ED1AE62
    > < HTTP/1.1 200 OK
    < Server: Apache-Coyote/1.1
    < Cache-Control: no-cache, no-transform
    < Expires: Wed, 25 Apr 2012 12:25:59 GMT
    < Content-Type: application/xml
    < Content-Length: 480
    < Date: Wed, 25 Apr 2012 12:25:59 GMT
    <?xml version="1.0" encoding="UTF-8" standalone="yes"?><couple xmlns:ns2="http://www.w3.org/2005/Atom" id="5" callId="5"><ns2:link type="application/xml" href="http://myserver/callrec/restful/couples.xml/5" rel="self"/><ns2:link type="application/xml" href="http://myserver/callrec/restful/couples.xml/5/pausedState" rel="pause/resume"/><from>5688</from><paused>false</paused><start>2012-04-25T13:58:25.985+02:00</start><to>5680</to></couple>
    Connection #0 to host myserver left intact
    * Closing connection #0

## Log Out from Pause/Resume API

     curl -v -b cookies.txt -c cookies.txt -X POST myserver/callrec/logoutprocess
    * About to connect() to myserver port 80
    * Trying 192.168.1.2... connected
    * Connected to myserver (192.168.1.2) port 80
    > POST /callrec/logoutprocess HTTP/1.1
    > User-Agent: curl/7.15.5 (i686-redhat-linux-gnu) libcurl/7.15.5 OpenSSL/0.9.8b zlib/1.2.3 libidn/0.6.5
    > Host: myserver
    > Accept: */*
    > Cookie: JSESSIONID=A7BF26C94EE0EA7F5F36DABFC9CDE08F
    > < HTTP/1.1 302 Moved Temporarily
    < Server: Apache-Coyote/1.1
    * Replaced cookie JSESSIONID="415DC8389E8F276EF9C12EB25F07463E" for domain myserver, path /callrec, expire 0
    < Set-Cookie: JSESSIONID=415DC8389E8F276EF9C12EB25F07463E; Path=/callrec
    < Location: http://myserver/callrec/index.jsp
    < Content-Length: 0
    < Date: Wed, 25 Apr 2012 14:32:25 GMT
    * Connection #0 to host myserver left intact