Skip to main content
Answer

Help with an API Parameter

  • November 21, 2022
  • 14 replies
  • 375 views

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

I’m trying to grab a list of courses from the API browser, but I want to try and add a parameter so that it returns only courses with a specific value in a course additional field (that happens to be a dropdown menu). 

I am trying to use the API: GET/learn/v1/catalog/{catalog_id}

One of the parameters is this:

Can someone provide a little guidance on if that is the correct parameter to filter for a course additional field?  If so, how do I fill that in appropriately for an additional field that is a drop down?

(For example purposes, my field ID number is ‘1’ and the dropdown element is “1” with the text value “Compliance”)

Best answer by avega

Hi Annarose,

This should work:
 

 

14 replies

  • Novice II
  • Answer
  • November 22, 2022

Hi Annarose,

This should work:
 

 


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

Thank you @avega   I did exactly that, and it doesn’t seem to work.  No matter what I put into there, I get the same results, but I don’t know if something is wrong with the request url that comes up? 

This is what I see: 

I’m assuming that the URL needs to be /learn/v1/catalog/4?field_01=4

Thoughts or suggestions?


Bfarkas
Hero III
Forum|alt.badge.img+6
  • Hero III
  • November 22, 2022

yeah, you are assuming right as far as I understand it, weird it is formatting that way.


  • Novice II
  • November 22, 2022

 


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

 

Thank you for the screen shot @avega! So then the request URL is correct based on the way I entered the parameter? Or is the API browser formatting that parameter incorrectly?


  • Novice II
  • November 22, 2022

I think its the browser converting the colon when the response is returned.
 

This works:


Try sending with a different catalog ID, one your username is assigned to.


samuel.adams
Docebian
Forum|alt.badge.img
  • Docebian
  • November 25, 2022

The API Browser is hard-coded for “field_xx” which actually needs to be replaced in the request. Here is an example of a correctly formatted request:

The recommendation is to use the additional field filter in a request sent outside of the API Browser.

It is important to note that without “show_item_list”, this endpoint will return all catalog results, even if they do not contain courses that match your search result. With “show_item_list”, you will see a “number_items” returned which tells you how many courses in the catalog match your search.

You can also use “list_catalogs_content” to only show an array of only the courses that match your search parameter, and not the catalog in which they are contained.


Bfarkas
Hero III
Forum|alt.badge.img+6
  • Hero III
  • November 25, 2022

The API Browser is hard-coded for “field_xx” which actually needs to be replaced in the request. Here is an example of a correctly formatted request:

The recommendation is to use the additional field filter in a request sent outside of the API Browser.

It is important to note that without “show_item_list”, this endpoint will return all catalog results, even if they do not contain courses that match your search result. With “show_item_list”, you will see a “number_items” returned which tells you how many courses in the catalog match your search.

You can also use “list_catalogs_content” to only show an array of only the courses that match your search parameter, and not the catalog in which they are contained.

Thanks for confirming this issue. Is it possible to get this logged somewhere for a potential fix in the browser since it seems to be a bug?


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

I have a ticket open for this so see if that can be fixed.  When I hear back, I will update the thread. This thread was super helpful with the ticket by the way!

Thank you all so much!


Bfarkas
Hero III
Forum|alt.badge.img+6
  • Hero III
  • November 28, 2022

I have a ticket open for this so see if that can be fixed.  When I hear back, I will update the thread. This thread was super helpful with the ticket by the way!

Thank you all so much!

Excellent, thanks!

In the short term are you using Postman or similar to get your needed info? Just tried out of curiosity and was working as expected there.


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

No I haven’t gotten that far yet. I am going to give it a shot today because I would really like to get this list of courses that I’m trying to pull out to a colleague. 


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

Update from Ticket: For some parameters, you cannot use the API browser as they will not be rendered correctly, so it is recommended that you use dedicated tools.  They updated the documentation to call that out here (Under the API Reference and Documentation section): https://www.docebo.com/it/knowledge-base/introduction-to-docebo-apis-2/

 


Bfarkas
Hero III
Forum|alt.badge.img+6
  • Hero III
  • December 1, 2022

Update from Ticket: For some parameters, you cannot use the API browser as they will not be rendered correctly, so it is recommended that you use dedicated tools.  They updated the documentation to call that out here (Under the API Reference and Documentation section): https://www.docebo.com/it/knowledge-base/introduction-to-docebo-apis-2/

 

Ha, interesting stance, feels like those parameters just shouldn’t be shown in the browser then. 

You make out with postman? 


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

Update from Ticket: For some parameters, you cannot use the API browser as they will not be rendered correctly, so it is recommended that you use dedicated tools.  They updated the documentation to call that out here (Under the API Reference and Documentation section): https://www.docebo.com/it/knowledge-base/introduction-to-docebo-apis-2/

 

Ha, interesting stance, feels like those parameters just shouldn’t be shown in the browser then. 

You make out with postman? 

Yes I did! Thank goodness!  Shout out to the Postman UX team, they made it really simple to figure out how to use it!