API & Webhooks

API Browser Quick Grabs: Listing Groups


Userlevel 7
Badge +3

This guide is the first in a new series of new guides brought to you by @Bfarkas. Check out his more comprehensive series on using Docebo API by going to his most recent guide on tagging content!

 

Series Overview

There has been an increase of requests/needs around the community lately that can be solved to some degree by using the API. Now I know many people, as soon as API is mentioned, don’t continue reading as they are just not comfortable using it. I get it. Please, just give me three more sentences before tuning out. 

 

The goal of this series is not to describe elaborate program processes you could do if you were comfortable with the API (and had a lot of tools and resources available to you). The goal is to leverage the incredible API Browser included with your Docebo account to do one simple call to get you the information you need. All the details for how to setup that one call, common options, common ways to leverage the information in other calls, any potential risks involved, etc. will be fully detailed so you feel comfortable working with Docebo’s API.

 

If you still want to run, that’s fine. If you are ready to give it a try, let’s dive into the first one.

 

 

Listing Groups

To know all the groups in the system, you currently have to either manually make a listing and keep it up to date, or do some creative workarounds. For instance, you could make a test user and ensure it is enrolled in every group. That way, you could use reports not designed for group reporting to make a list. That, however, is a lot of work.

 

The API Browser gives a simple endpoint to get a listing of the ID, Name, Description, and Member Count of groups in the system. This is a great one to start with, as you are simply viewing information. This way, you don’t have to worry about causing problems in your platform. Here’s how to use it:

 

  1. Log into your Docebo instances API Browser by going to: https://<yoursubdomain.docebosaas.com>/api-browser/ 

     

  2. On the ‘Services’ menu, select ‘Manage’.

     

  3. Scroll down the left side to find and select the ‘Group’ category.

 

  1. Select the ‘Returns all visible groups’ option.
  1. There are 4 fields to be aware of on the middle area to be aware of:
    1. sort_attr: This sets which piece of data about each group is used to sort the order of the list. By default (leaving the field blank) this will be the unique Docebo ID assigned to the group. If you prefer to sort differently you can enter ‘name’ or ‘description’ into this field. 
    2. sort_dir: Do you want the order of the attribute you selected in the previous field to be ascending or descending. By default (leaving the field blank) it will be descending, if you want it to be ascending put ‘asc’ in the field.
    3. page_size: This endpoint can have very long lists. To avoid performance issues it will make pages of results. This lets you set how many items show up on a page. By default it is 10 items. The maximum size is 200 items. Enter an appropriate number for your needs here.
    4. page: This endpoint can have very long lists. To avoid performance issues it will make pages of results. This field let’s you choose which of those pages you view in the output. For example, if you have 50 groups and the page size was set to 20, 3 pages would be generated. When you initially run the endpoint you will see items 1-20. If you put a 2 in this field you will then get items 21-40, put a 3 in this field to get 41-50.

 

  1. Enter the appropriate information in the fields described above.

.

  1. Select the ‘OAUTH’ button underneath the options and sign in (if you have not done so already).

 

  1. Select the ‘Try’ button.
  2. The request and response should open in the middle of your screen:

     

  3. The information about the groups will be found in the ‘Response Body’ box. If you are comfortable reading or using JSON formatted data, you can simply use this box as is, and you are done. If you want this data in a more convenient table format, keep reading.

 

  1. Open the Excel or Google Sheets file attached to this guide. They work the same but are available in different formats for personal preference or restrictions on work computers.
    • Access ‘API-AllGroupsJSON_Convert’ on Google Sheets here and make your own copy.
    • Download ‘API-AllGroupsJSON_Convert’ for Excel by downloading the file attached at the bottom of this guide.

 

  1. Select and copy all the content from the ‘Response Body’ shown in step 9.

 

  1. On the first tab, ‘Drop Data’ in the workbook, paste the content into cell B4. Notice there are 5 boxes setup to paste content into. This is for cases where you have multiple pages. The workbook is designed to allow you to put up to 5 pages of 200 items each so you can convert 1,000 groups into a table.

Note: Make sure to paste as plain text/remove all formatting.

 

  1. If you have multiple pages in the API Browser, repeat the process of updating the page number, trying the endpoint, copy the response body, and paste into the next available open box in column B.

 

  1. Once you have copied all the raw groups information, switch to the ‘Output’ tab at the bottom of the screen.
  2. Here you will find a pre-formatted table of all the results. Feel free to sort/filter the table however you want. You can also use ‘Save As’ on this page to generate a CSV of your groups.

 

That’s it! Now you have a nice table of all your group information. This is useful for watching for potentially broken automatic groups (0 users, or far too many users), find groups to remove (0 users), keep an eye out for redundant groups, etc. 

 

More API Browser Quick Grabs:

Bulk Update Course information

Listing Locations

Bulk Unenroll Users from Courses or Learning Plans

Bulk Update User’s Enrollment to a Completion

Bulk Enroll and Mark User Complete in a Course

Bulk Create Power Users

Bulk Remove Power User Level from Users

 

There are lots of ways to use the API Browser to quickly retrieve information. How do you use the API Browser?


19 replies

Userlevel 7
Badge +3

If you found this Quick Grab useful, or you would but you still did not want to play around with copying the JSON outputs, good news!

FarkTools initial beta of a group management tool is now available!

All the functions this article covers can now be done without any copying and pasting needed. Check it out if you are interested at https://fark.tools

Userlevel 5
Badge

Thanks for the get solution. I have been doing this manually. One useful item I found with Microsoft Edget is to right click at the bottom of the output, do Web Select, and then highlight the last few rows. It selects all of the output quickly and cleanly.

Userlevel 3

@Bfarkas thanks for sharing this! This was extremely helpful. Would you happen to have a guide for doing the same for enrollment rules? We currently struggle with identifying which groups are assigned to each course.

Thanks in advance. 

Userlevel 7
Badge +3

Thanks for the get solution. I have been doing this manually. One useful item I found with Microsoft Edget is to right click at the bottom of the output, do Web Select, and then highlight the last few rows. It selects all of the output quickly and cleanly.

Absolutely a way to go, the fark.tools version lets you cleanly export instantly too, if you prefer, bunch of additional options available.

Userlevel 7
Badge +3

@Bfarkas thanks for sharing this! This was extremely helpful. Would you happen to have a guide for doing the same for enrollment rules? We currently struggle with identifying which groups are assigned to each course.

Thanks in advance. 

Thanks @niccole.liriano , the enrollment rules are a tad more complex so probably would not be a safe ‘Quick Grabs’ topic. I have been looking into them as an additional feature of the groups management tool in Fark.Tools but trying to make sure it is simple and clean. May I ask, would your want be to simply easily see if rules are applied from a group and to be able to see the course if applicable? Would it be ok not to be able to edit them from there?

Userlevel 3

@Bfarkas Thanks for that! Yes, the need would be to see the groups assigned to the enrollment rules along with which courses. As long as we can see that information, I think not being able to edit them would be fine. 

Userlevel 7
Badge +3

@Bfarkas Thanks for that! Yes, the need would be to see the groups assigned to the enrollment rules along with which courses. As long as we can see that information, I think not being able to edit them would be fine. 

Thanks, I added it to the backlog of the groups tool to look into, more soon.

Hi @Bfarkas ,

 

Thanks a lot for providing this solution. It has been a very helpful first step in the cleanup within our organization. One question I had: is there way to extract data on whether a Group is Manual or Automatic + extract the creator names of each Group? So that they are 2 additional columns in the overview.

 

All the best,

Jin

Thanks for the guide, it was really helpful and saved us a lot of time!

I was wondering if there is a way to retrieve the eligibility conditions for each group.

Thank you!
 

Userlevel 7
Badge +3

Thanks for the guide, it was really helpful and saved us a lot of time!

I was wondering if there is a way to retrieve the eligibility conditions for each group.

Thank you!
 

There is, but it is far more complex and not a one call get. I am working on simplifying it and integrating it into the groups management tool at fark.tools though, will circle back when complete.

Userlevel 5
Badge

Hi @Bfarkas - My data shows that I have 287 groups but when I follow the instructions here, my output shows 197. Any ideas what could have gone wrong?

Userlevel 7
Badge +3

Hi @JKolodner when you say the output do you mean within the API Browser, or within the Excel doc?

Userlevel 7
Badge +3

Thanks for the guide, it was really helpful and saved us a lot of time!

I was wondering if there is a way to retrieve the eligibility conditions for each group.

Thank you!
 

There is, but it uses the new Audiences API, I have a backlog item to re-write this post using the Audiences API instead of the Groups that is being deprecated. More on that soon, but if you are comfortable within the API Browser check it out:

 

It is the ‘Audiences’ area on the services menu, and then there are a couple of calls that would retrieve the conditions/rules of each

Userlevel 5
Badge

Hi @JKolodner when you say the output do you mean within the API Browser, or within the Excel doc?

 

@Bfarkas  - In this case, I meant within your Excel doc.

Userlevel 7
Badge +3

Hi @JKolodner when you say the output do you mean within the API Browser, or within the Excel doc?

 

@Bfarkas  - In this case, I meant within your Excel doc.

Interesting, so first, crossing threads here, but another route to go for your skills discussion is to build something out like this doc, its not my favorite, and actually why I started building Fark.Tools instead, but it does work.

That being said in this particular case, can I PM you an email address where you can maybe share the file so I can see what is going on?

@Bfarkas - a minor suggestion - would be a good idea to add a note about Groups APIs getting deprecated (they are removed from API browser) and to use Audience APIs instead.

 

Thank you for your API quick grabs, those are super helpful!!

Userlevel 7
Badge +3

Yeah @Deepak what really needs to happen here is I need to finish writing the Audience API one and this should just go away. Problem of changes over time and writing documents :)

Yeah @Deepak what really needs to happen here is I need to finish writing the Audience API one and this should just go away. Problem of changes over time and writing documents :)

Thank you for all your articles and tutorials - have been super helpful!

I am going to be working with Audiences API - surprisingly I haven’t come across any official documentation on transition towards Audiences from Groups. 

Userlevel 7
Badge +3

Yeah @Deepak what really needs to happen here is I need to finish writing the Audience API one and this should just go away. Problem of changes over time and writing documents :)

Thank you for all your articles and tutorials - have been super helpful!

I am going to be working with Audiences API - surprisingly I haven’t come across any official documentation on transition towards Audiences from Groups. 

Yeah, there isn’t really and there are not direct equivalents for them all either. I am going to move this up my list for an article and for a community coaching session I think.

Reply