Description:

It will authenticate the user with the credentials and will generate 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 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"
        }
    }
}

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 user, so it must be sent with every request which requires authentication.

 Parameter                                                  Description
  token Example: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOjEsImlzcyI6Imh0dHA6Ly9qYW1ib3JlZWJsaXNzLmNvbS9zYXlhci9wdWJsaWMvYXBpL3YxL2F1dGhlbnRpY2F0ZSIsImlhdCI6MTUyMjMyNTkzMSwiZXhwIjoxNTIyMzI2MTcxLCJuYmYiOjE1MjIzMjU5MzEsImp0aSI6IjQ1Z25iTWNHMFFxTjJNQTgifQ.ZSqbCnKp4tvnsEQ9ylyuMQlJ-a2YwO3_b

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 an unique id of logged user (Example: id=23)
user_name It is an unique name of logged user (Example: user_name=Jayesh)
first_name It is first name of logged user (Example: first_name=Jayesh)
last_name It is last name of logged user (Example: last_name=Kamat)
email It is last email of logged user (Example: email=jayesh.k@gmail.com)
role It returns role of the  logged in user in helpdesk (Example: role:User or role=Agent or role=Admin)
profile_pic It contains an profile picture of logged user. It can be an image or an 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 *