LeadSquared Developer Centre

ON THIS PAGE

Get User Hierarchy Information


Retrieves user hierarchy.

  • When an Admin User passes a user’sUserIdin the request, then –
    • If user hierarchy is enabled, the details of all the users reporting to theUserIdpassed will be retrieved.
    • If user hierarchy is disabled, then the details of all the Sales Users reporting to the group manager (who’sUserIdis passed) will be retrieved.
  • When a Sales Manager passes a user’sUserIdin the request, then –
    • If user hierarchy is enabled, the details of all the users reporting to theUserIdpassed will be retrieved, provided the Sales Manager is the reporting manager for the user (who’sUserIdis passed).
    • If user hierarchy is disabled, then the users in the sales group reporting to that specific user (who’sUserIdis passed) is retrieved, depending on the User Access Permissions granted to the Sales Manager.
  • When a Marketing User passes a user’s UserId in the request, then –
    • If user hierarchy is enabled, the details of all the users reporting to theUserIdpassed will be retrieved, provided the Marketing User is the reporting manager for the user (who’sUserIdis passed).
    • If user hierarchy is disabled, then the users in the sales group reporting to that specific user (who’sUserIdis passed) is retrieved, depending on the User Access Permission granted to the Marketing User.
  • When a Sales User passes a user’s UserId in the request, then –
    • If user hierarchy is enabled, then the details of all the users reporting to theUserIdpassed will be retrieved, provided the Sales User is the reporting manager for the user (who’sUserIdis passed).
    • If user hierarchy is disabled, then the users in the sales group reporting to that specific user (who’sUserIdis passed) is retrieved, provided the Sales User is also the Group Manager for that user (who’sUserIdis passed).

Note: To return only selected user fields, you can pass an additional Columns object as follows –

{
"UserId":"3b1041fb-8374-11e7-8758-0a106ee76b21",
"Include":"All",
"Columns":{
"Include_CSV":"Designation,IsEmployee,EmployeeId,DateOfBirth"
}
}

 

API URL

URL
Icon
POST https://{host}/v2/UserManagement.svc/RetrieveUserInfoByHierarchy?accessKey=AccessKey&secretKey=SecretKey

Request

Content-Type: application/json
JSON Body/Payload Icon
{
   "UserId":"3b1041fb-8374-11e7-8758-0a106ee76b21",
   "Include":"All"
}

Request Parameters

Parameter Description
UserId

The unique Id of each user. To get theUserIdof your users, please refer to the Get Users API.

Include

The status of the users you want to retrieve. The following options are available

  • All– Retrieves the information of all the users in the system.
  • Check-in– Retrieves the information of only checked-in users.
  • Check-out– Retrieves the information of only checked-out users.
  • Active– Retrieves the information of only active users.
  • If this field is empty, thenAllis passed by default.

Response

200 OK
Content-Type: application/json
{
   "SearchInfo":{
      "TotalUsers":3
   },
   "Users":[
      {
         "UserId":"718ae557-9d0b-11e7-b0ab-02e89b2fb8f4",
         "Name":"John George",
         "Mobile":"+91-123212332",
         "Email":"john@example.com",
         "CheckedIn":"false",
         "IsActive":"true"
      },
      {
         "UserId":"9a86dca1-9d0b-11e7-b0ab-02e89b2fb8f4",
         "Name":"Jack Paul",
         "Mobile":null,
         "Email":"jackdoe@example.com",
         "CheckedIn":"false",
         "IsActive":"true"
      },
      {
         "UserId":"9e660b12-6fdf-11e8-8455-020714094d7e",
         "Name":"Zane Doe",
         "Mobile":null,
         "Email":"zane@example.com",
         "CheckedIn":"false",
         "IsActive":"true"
      }
   ]
}

HTTP Response Codes

Code Description
200 OK

This is the status code for successful API call.

401 Unauthorized

The API call was made with invalid access credentials. Check your AccessKey and SecretKey.

400 Bad Request

The message body on the request is not as per API specification. Make sure that content type is set to “application/json” and the JSON body has correct attribute names and structure.

404 Not Found

The API could not be found. Please check the API signature.

429 Too Many Requests

API calls exceeded the limit of 25 in 5 second(s)

500 Internal Server Error

The API called failed. There could be many reasons for it. Check the exception message to get more details.

On this page

© 2022 by MarketXpander Services Pvt Ltd. All Rights Reserved.