All Classes Functions Pages
CustomerLoginExamples Class Reference

Detailed Description

Examples for Login Customer

Example 1 - Login a customer

This example demonstrates the following:

  • Logging in a customer by providing valid credentials. This example assumes that 5 concurrent sessions for this customer do not exist, and hence, the API will be successful.

XML

Request

Method URL
POST /ws/v15/context/authentication/user/login

Request headers

Name Value
Accept application/xml
Content-Type application/xml
Accept-Language en-US

Request body:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<login xmlns="http://bindings.egain.com/ws/model/v15/gen/platform">
    <userName>customer1</userName>
    <password>password@123</password>
</login>

     

Response:
HTTP/1.1 204 No Content

Response headers

Name Values
X-egain-session Newly generated session ID
Content-Type application/xml

JSON

Request

Method URL
POST /ws/v15/context/authentication/user/login

Request headers :

Name Value
Content-Type application/json
Accept application/json
Accept-Language en-US

Request body:

{
   "userName": "customer1",
   "password": "password@123"
}

Response:
HTTP/1.1 204 No Content

Response headers

Name Values
X-egain-session Newly generated session ID
Content-Type application/json

     



Example 2 - Login a customer with forceLogin query parameter

This example demonstrates the following:

  • Logging in a customer by providing valid credentials.
  • Using the forceLogin query parameter in the request.

XML

Request

Method URL
POST /ws/v15/context/authentication/user/login?forceLogin=yes

Request headers

Name Value
Accept application/xml
Content-Type application/xml
Accept-Language en-US

Request body:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<login xmlns="http://bindings.egain.com/ws/model/v15/gen/platform">
    <userName>customer1</userName>
    <password>password@123</password>
</login>

     

Response:
HTTP/1.1 204 No Content

Response headers

Name Values
X-egain-session Newly generated session ID
Content-Type application/xml

JSON

Request

Method URL
POST /ws/v15/context/authentication/user/login?forceLogin=yes

Request headers :

Name Value
Content-Type application/json
Accept application/json
Accept-Language en-US

Request body:

{
   "userName": "customer1",
   "password": "password@123"
}

Response:
HTTP/1.1 204 No Content

Response headers

Name Values
X-egain-session Newly generated session ID
Content-Type application/json