Skip to main content
Answer

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

  • July 18, 2022
  • 2 replies
  • 553 views

Annarose.Peterson
Hero III
Forum|alt.badge.img+7

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. 

 

Best answer by John

@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.

2 replies

John
Docebian
Forum|alt.badge.img+3
  • Docebian
  • July 18, 2022

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.


John
Docebian
Forum|alt.badge.img+3
  • Docebian
  • Answer
  • July 18, 2022

@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.