Description:
Authenticates a user and gives his/her profile information back if successful.
URL: v3/api/login
Method: POST
Response Format: JSON
Parameters :
Name | Data Type | Required / Optional | Description |
user_name | String | Required | Username of the agent |
String | Required | Email address of the agent | |
password | String | Required | Password of the agent |
Note: Only one parameter—either user_name or email—is required for authentication.
Success Response :
{ "success": true, "data": { "token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOjEsImlzcyI6Imh0dHA6Ly9sb2NhbGhvc3Q6ODAwMC9hcGkvbG9naW4iLCJpYXQiOjE1MTg2MDI1NTAsImV4cCI6MTUxODYwMjc5MCwibmJmIjoxNTE4NjAyNTUwLCJqdGkiOiJpTjFMSkl5M0U2UXB5aUpaIn0.QrXxRYlowT4v2BayTNvapnHUe1vMJ_NlXydgJoS7y1E", "user": { "id": 1, "user_name": "Ak403602@gmail.com", "first_name": "Avinash", "last_name": "Kumar", "gender": "0", "email": "ak403602@gmail.com", "ban": "0", "active": "1", "is_delete": "0", "ext": "", "country_code": "", "phone_number": "", "mobile": "Not available", "agent_sign": "", "account_type": "", "account_status": "", "assign_group": "1", "primary_dpt": "1", "agent_tzone": "", "daylight_save": "", "limit_access": "", "directory_listing": "", "vacation_mode": "", "company": "", "role": "admin", "internal_note": "", "profile_pic": "https://secure.gravatar.com/avatar/c0c345537c5e16277d4b9c70014f8aee?s=80&r=g&d=identicon", "fcm_token": null, "i_token": null, "created_at": "2018-02-12 08:43:56", "updated_at": "2018-02-14 07:21:44", "location": null, "user_language": null, "mobile_otp_verify": "1", "email_verify": "1", "is_login": "1", "not_accept_ticket": "0", "ldap_username": "", "isldapauth": "0" } } }
Next, read How to pass OAuth2 token in API version 3
For the users who use LDAP Login
URL: v3/api/login
Method: POST
Response Format: JSON
Parameters :
Name | Data Type | Required / Optional | Description |
String | Required | LDAP login Username | |
password | String | Required | Id of the status in which ticket LDAP Login Password |
ldap | String | Required | true |
ldap_id | String | Required | id of the ldap login button |
Response:
{
“success”: true,
“data”: {
“id”: 1073,
“first_name”: “User”,
“last_name”: “One”,
“email”: “userone@mail.com”,
“user_name”: “cn=user one,dc=tk”,
“token”: “eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsImp0aSI6ImEwMzNkMGY5YWJlMjFkMGNiOWNlNDM0YjE2ZDU5OGEwMTRkNGRkOTQzNTBmOGY1MDdiYWQ2MzQ4Zjk3YzViZWU4NWRlZWNlODdjMWIyZDZkIn0.eyJhdWQiOiIxIiwianRpIjoiYTAzM2QwZjlhYmUyMWQwY2I5Y2U0MzRiMTZkNTk4YTAxNGQ0ZGQ5NDM1MGY4ZjUwN2JhZDYzNDhmOTdjNWJlZTg1ZGVlY2U4N2MxYjJkNmQiLCJpYXQiOjE2MzY5NzMxMjQsIm5iZiI6MTYzNjk3MzEyNCwiZXhwIjoxNjY4NTA5MTI0LCJzdWIiOiIxMDczIiwic2NvcGVzIjpbXX0.cBD_J5X0hCLaWfjnVsc9DiMGazCtgiQNPXzIfoia794mvP0sspDw3rC0hufddngHeORV2ZOHWggDfbvv2G3dByd2yO4_cnka8tf31BSe01Y2QJOeJ8XUyc-JSgdLdNa4nN0aFRR8pIaJjKlviDg4”
}
}
I am able to successfully POST to Login and get a token back.
I am unable to use the token for retrieving subsequent ticket information and token is not listed as a parameter in any of the new ticket APIs.
Providing it as “token” or not simply results in:
{“result”:{“fails”:”Unauthorized! Please login again”}}
How do I retrieve ticket info with the ne APIs?
Please check this post to understand how to use the token you get in the response.