Description:

It will authenticate the user with the credentials and will generate a token.

URL :   api/v1/authenticate

           (Replace this URL with you helpdesk URL)

Parameters :

Name Data Type Required / Optional Description
username String Required Username of the user/agent or Email of the user/Agent
password String Required Password of the user/agent
api_key String Optional An alphanumeric code that can be used to authenticate your API calls

HTTP Method : POST

  •   URL Request Example:

https://www.stablehelpdesk.faveodemo.com/api/v1/authenticate?username=demoadmin&password=demopass                                                                                                                                        

Response

  •   Response Format: JSON
  •   Returns JSON which contains user data with the token

Sample JSON Success Response :

{
   "success": true,

   "data": {

       "token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOjEsImlzcyI6Imh0dHA6Ly9qYW1ib3JlZWJsaXNzLmNvbS9zYXlhci9wdWJsaWMvYXBpL3YxL2F1dGhlbnRpY2F0ZSIsImlhdCI6MTUyMjMyNTkzMSwiZXhwIjoxNTIyMzI2MTcxLCJuYmYiOjE1MjIzMjU5MzEsImp0aSI6IjQ1Z25iTWNHMFFxTjJNQTgifQ.ZSqbCnKp4tvnsEQ9ylyuMQlJ-a2YwO3_bvPrc2OqhEc",

       "user": {

           "id": 1,

           "user_name": "demoadmin",

           "first_name": "Saifu",

           "last_name": "QA",

           "email": "saifu@gmail.com",

           "role": "admin",

           "profile_pic": "https://secure.gravatar.com/avatar/b904e33fae6773197726e7e06bb2b0c0?s=80&r=g&d=identicon"

       }

   }

}

Response Description:

   Parameter                                                    Description
     success  It will give success=true if authentication is successful and success=false for authentication failure of API call
      data It returns JSON. It gives token and all user-related data.

token: On successful authentication token is returned in the JSON. It is for authenticating the user, so it must be sent with every request which requires authentication.

user JSON data. This will return basic information of the authenticated user on success. On failure, this array will not be returned

        Parameter                                                  Description
id It is a unique id of the logged user (Example: id=23)
user_name It is a unique name of the logged user (Example: user_name=Jayesh)
first_name It is the first name of the logged user (Example: first_name=Jayesh)
last_name It is the last name of a logged user (Example: last_name=Kamat)
email It is the email of the logged user (Example: email=jayesh.k@gmail.com)
role It returns the role of the  logged in user in helpdesk (Example: role: User or role=Agent or role=Admin)
profile_pic It contains a profile picture of the logged user. It can be an image or a gravatar image

Possible Errors/Failures:

*Please check the responses for some common errors

Leave a Reply

Your email address will not be published. Required fields are marked *