# Genesys Quality Management Suite 8.1.520 : Detailed Steps

## Log In

To log in, issue a POST request to the following URI:

    <server>/callrec/loginAction.do

The request body should be form-encoded (application/x-www-form-urlencoded), with the following parameters:

    login=<username>&password=<password>

A known issue requires the login request to include an arbitrary HTTP cookie (the contents of the cookie are not important). See the Java client source code for a code example.
Important: The response of this POST request will not indicate the success or failure of the login.

## List Calls

To list calls, issue a GET request to the following URI:

    <server>/callrec/restful/couples.xml

This request can be accompanied by the following additional search parameters:
To filter by IP address, use parameters in the following form:
`ipAddress=<value>&ipAddressDirection=<direction>`

- `<value>` specifies the actual IP address.
- `<direction>` may be one of the following: `CALLING, CALLED` or `BOTH`.
- `ipAddressDirection` is optional. If this is missing, BOTH is assumed.

To filter by phone number, use parameters in the following form:
`phoneNumber=<value>&phoneNumberDirection=<direction>`

- `<value>` specifies the phone number.
- `<direction>` is the same as above (same possible values, same default value).

These searches may be combined, but it is unnecessary since both filters will return only one call at a time.
A `403 (Forbidden)` response means the user is not logged in. A response with status `200 (OK)` will contain an xml document listing the calls in progress that satisfy the search condition. Each call MAY contain a URI to its details in Atom format (if it does not, this means that the user does not have the permissions to see the details of this call), with the rel attribute set to self. The URI can be found by using XPath:

    /couples/couples/link[@rel='self']/@href

Example:
A sample response XML document for the request URI (one call in progress):

     http://<server>/callrec/restful/couples.xml

    <couples>
     <couples id="24197" callId="24142">
     <ns2:link type="application/xml" href="http://<server>/callrec/restful/couples.xml/24197" rel="self"/>
     <from>5630</from>
     <paused>false</paused>
     <start>2011-03-21T12:51:55.364+01:00</start>
     <to>5509</to>
     </couples>
    </couples>

## Obtain Call Details

By following this call details URI (GET request), the user will receive an XML document with the call details, which MAY (if the user has the sufficient rights to the operation) contain an Atom URI to pause/resume. The URI can be found by using XPath:

     /couple/link[@rel='pause/resume']/@href

Example:

The XPath:

     /couples/couples/link[@rel='self']/@href

For this XML evaluates to:

    http://<server>/callrec/restful/couples.xml/24197

A GET request to this URI results in a response that is wrapped by the following XML:

    <couple id="24197" callId="24142">
     <ns2:link type="application/xml" href="http://<server>/callrec/restful/couples.xml/24197" rel="self"/>
     <ns2:link type="application/xml" href="http://<server>/callrec/restful/couples.xml/24197/pausedState" rel="pause/resume"/>
     <from>5630</from>
     <paused>false</paused>
     <start>2011-03-21T12:51:55.364+01:00</start>
     <to>5509</to>
    </couple>

## Pause or Resume Call/Screen Recording

To pause or resume call/screen recording, issue a POST or PUT request to the given URI. The body should be of mime type `application/x-www-form-urlencoded` and should be either `paused=true` or `paused=false`, depending on whether a pause or a resume is requested. The response may safely be ignored.

Example:

The XPath:

     /couple/link[@rel='pause/resume']/@href

For this XML evaluates to the URI:

    http://<server>/callrec/restful/couples.xml/24197/pausedState

A GET request to this URI returns the current state (not paused). In this case the false string.
A PUT request to this URI with the `form-urlencoded` request body containing `paused=true`, pauses this call. A PUT request containing the parameter `paused=false` resumes the call again.

    <couples>
     <couples id="24197" callId="24142">
     <ns2:link type="application/xml" href="http://<server>/callrec/restful/couples.xml/24197" rel="self"/>
     <from>5630</from>
     <paused>true</paused>
     <start>2011-03-21T12:51:55.364+01:00</start>
     <to>5509</to>
     </couples>
    </couples>

## Log Out

Issue a GET request to the following URI:

    <server>/callrec/logoutprocess