How to get Inactive Users via api call from outside sugar.

Hi,
I am trying to find a user in sugar via user_name field and that user is inactive. While making api call via postman i am not getting that inactive user detail.


http://<localhost>/rest/v11/Users/?filter[0][user_name]=Test

Is there any param available for getting the inactive user via api call or do i need to make some customization in sugar to get that user.

Thanks

Parents
  • You might need a custom API if you want to access inactive users, since sugar filters out Inactive users in the API by default.

    Use this documentation to know how to create Custom APIs - https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_10.1/Integration/Web_Services/REST_API/Extending_Endpoints/

    May I know why you need inactive user info? If the API doesn't return anything, you can assume they don't have access to Sugar.

  • I need to sync records to sugar from other system. and that system may have some records assigned to inactive user. That system provides user_name as assignment identity. So first i need to fetch that user from sugar via that username and then do assignment.
    As username can be of inactive user so i am not able to get the id of that user via default get api call.
    So thats why i was asking is there any default way to achieve that. Or i need to write custom api.

  • Interesting, thanks for the explanation -

    You may have to write a custom API to search by Inactive users, since Sugar filters them out by default. Follow this link on how to create custom APIs - and you can write your custom logic to return the Inactive user IDs.

    But - there are a couple of other options you could explore:

    1. Make the user active, migrate the data, and then make the user inactive again. If you want to disable login, you can just set a random password in user_hash and force sugar_login as true.

    2. Get all the list of users upfront from the DB (or from the Admin UI), cache them and use the IDs directly in your migrate script.

Reply
  • Interesting, thanks for the explanation -

    You may have to write a custom API to search by Inactive users, since Sugar filters them out by default. Follow this link on how to create custom APIs - and you can write your custom logic to return the Inactive user IDs.

    But - there are a couple of other options you could explore:

    1. Make the user active, migrate the data, and then make the user inactive again. If you want to disable login, you can just set a random password in user_hash and force sugar_login as true.

    2. Get all the list of users upfront from the DB (or from the Admin UI), cache them and use the IDs directly in your migrate script.

Children