All Web API services require the API client to be authenticated with Call Recording before issuing a request. Authentication is achieved using the Log In Service

Service Pre-requisites

None

Service Invocation

An HTTP POST method must be addressed to the following URL:

http://<server-url>/callrec/loginservlet

Input Parameters

The service requires two parameters:

  • username
  • password

These two parameters should be sent with the following content-type: application/x-www-form-urlencoded.

  • The username is sent in the form: loginname=<username>
  • The password is sent in the form: password=<username>

Output

The service will return:

  • An HTTP status. This status can be: 200 OK: always returned
  • A body response in text/xml with details about the operation; for example: Access is authorized.
  • A Java session ID (JSESSIONID); for example: sessionid="E3D794FEE4638143C1C89C18F693EB6B"

This identifier will be returned both as a cookie and in the body of the response. It will be needed for all further API operations.

This status will be sent in all cases, including when the username and password are correct, incorrect, or when the request is malformed.

Log In Service Example

With Firefox:

To log into Call Recording, point to this address:

http://<server>/callrec/loginservlet?loginname=<
username>&password=<password>

 

The Service will reply with a response similar to the following:

<ok sessionid="BA803B97624F0880A4C58B78C733EB5B" number="1">Access is authorized.</ok>

Note that the reply includes a JSESSIONID value. It will be needed later for the other services.

 

With cURL:

curl -v -b cookies.txt -c cookies.txt -X POST -d "loginname=<username>" -d "password=<password>" \ -H"Content-Type: application/x-www-form-urlencoded" -H"Accept: text/plain" http://<server>/callrec/loginservlet

 

The service will reply with a JSESSIONID (present both in the XML response and the created cookies.txt cookie file). This is required later for accessing the other services:

 * About to connect() to myserver port 80 (#0)
* Trying 10.0.0.1... connected
* Connected to myserver (10.0.0.1) port 80 (#0)
> POST /callrec/loginservlet HTTP/1.1
> User-Agent: curl/7.21.0 (x86_64-pc-linux-gnu) libcurl/7.21.0 OpenSSL/0.9.8o zlib/1.2.3.4 libidn/1.18
> Host: myserver
> Content-Type: application/x-www-form-urlencoded
> Accept: text/plain
> Content-Length: 33
> < HTTP/1.1 200 OK
< Server: Apache-Coyote/1.1
* Added cookie JSESSIONID="E3D794FEE4638143C1C89C18F693EB6B" for domain myserver, path /callrec, expire 0
< Set-Cookie: JSESSIONID=E3D794FEE4638143C1C89C18F693EB6B; Path=/callrec
< Transfer-Encoding: chunked
< Date: Fri, 20 May 2011 10:10:18 GMT
< <?xml version="1.0" encoding="UTF-8"?> <ok sessionid="E3D794FEE4638143C1C89C18F693EB6B" number="1">Access is authorized.</ok>
* Connection #0 to host myserver left intact
* Closing connection #0

 

A cookies.txt file will be created with the following content:

 # Netscape HTTP Cookie File
# http://curl.haxx.se/rfc/cookie_spec.html
# This file was generated by libcurl! Edit at your own risk. myserver	FALSE	/callrec	FALSE	0 JSESSIONID	E3D794FEE4638143C1C89C18F693EB6B