Best Answer

Most efficient way to get the Branch for a user with APIs

  • 18 July 2022
  • 2 replies
  • 418 views

Userlevel 7
Badge +6

We are trying to retrieve the branch for all of our users and we are not seeing a more efficient way of doing it.  

/manage/v1/user does not return a branch ID for the users.  /manage/v1/user/{user_id} does, but then we would need to call that for each user to get the branch ID, which doesn’t seem too efficient.

Does any one have ideas or encountered any similar issue and have a more efficient solution?

 

I know there is this Idea out there, in case anyone else has run into this issue, we can vote it up. 

 

icon

Best answer by John 18 July 2022, 18:52

View original

2 replies

Userlevel 5
Badge +2

Hey @Annarose.Peterson,

Have you tried from Users Management, select all users, then choose the Export to CSV option. You should see towards the bottom these Branch fields available for export:

Hopefully that helps avoid the API calls and instead jump right to the CSV.

Userlevel 5
Badge +2

@Annarose.Peterson There is an API under Manage > Users service that returns user ID’s for those within the branches inside the filter params you send. Here is an example:

(basURL)/manage/v1/user/list?branch_ids[35][id]=1&branch_ids[35][include_descendants]=true

Within this APIs filters you can also include “expand” data that could include things like Username if that’s more easily readable or aligns to your data needs better.

Reply