WSAPI. More...
This is an authentication API for accessing the knowledge base resources. The server authenticates the given login username and password and creates a new egain session ID for the requesting user.
This eGain session ID can be then used in the subsequent user requests.
Session ID, once expired, cannot be used again and a new session ID can be created by using this API.
Schemas used
| Method | URI | Description |
|---|---|---|
| POST | /ws/v12/authentication/user/login | Authenticates user's login request and creates a new session ID. |
| Name | Description |
|---|---|
| Content-Type | application/xml or application/json |
| Accept | application/xml or application/json |
| Accept-Language | Optional header that is used to specify the language of error messages. Default value is the primary KB language assigned to the user. See Supported 'Accept-Language' header language codes. |
The request body is mandatory. Request body can be in either XML or JSON format.
| Name | Description | Type |
|---|---|---|
| username | Login user name. | String |
| password | Password for the above user name. | String |
None
| Name | Description |
|---|---|
| forceLogin | This is an optional query parameter. The only possible value is "yes". In the application, a maximum of 5 concurrent sessions are allowed for a user. The sixth request will fail, unless this parameter is sent along with the request. If this parameter is sent, the earliest session is terminated and a new session is created. |
None
The response includes HTTP status code and headers only. No response body.
204 - No Content
| Name | Description |
|---|---|
| Content-Type | application/xml or application/json |
| X-egain-session | Newly generated session ID |
No response body is returned on successful authentication.
An error body is returned when the user request could not be successfully processed.
Different error codes returned by this API are listed in the 'Failure Status Code' section.
| Method | URI | Description | Http Code Returned |
|---|---|---|---|
| POST | /ws/v12/authentication/user/login | Assuming the user request is successfully processed, a 204 success code is returned. No response body is returned by the server in this case. | 204 |
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <Login xmlns="http://bindings.egain.com/ws/model/v12/gen/platform"> <userName>kbagent1</userName> <password>egain123</password> </Login>
204 - No Content
| Method | URI | Description | Http Code Returned |
|---|---|---|---|
| POST | /ws/v12/authentication/user/login?forceLogin=yes | Assuming the user request is successfully processed, a 204 success code is returned. This example also demonstrates using the query parameter 'forceLogin'. | 204 |
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <Login xmlns="http://bindings.egain.com/ws/model/v12/gen/platform"> <userName>kbagent1</userName> <password>egain123</password> </Login>
204 - No Content
| Method | URI | Description | Http Code Returned |
|---|---|---|---|
| POST | /ws/v12/authentication/user/login | Below is the error response when user's credential, either username or password, could not be authenticated by the server. | 401 |
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <Login xmlns="http://bindings.egain.com/ws/model/v12/gen/platform"> <userName>kbagent567</userName> <password>egain123</password> </Login>
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <error xmlns="http://bindings.egain.com/ws/model/v12/gen/platform"> <message>User credentials could not be authenticated. Username : kbagent567</message> </error>
| Method | URI | Description | Http Code Returned |
|---|---|---|---|
| POST | /ws/v12/authentication/user/login | Json request body. | 204 |
{
"userName": "kbagent1",
"password": "egain123"
}
204 - No Content