Best Answer

Help with an API Parameter

  • 21 November 2022
  • 14 replies
  • 92 views

Userlevel 7
Badge +3

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”)

icon

Best answer by avega 22 November 2022, 01:57

View original

14 replies

Hi Annarose,

This should work:
 

 

Userlevel 7
Badge +3

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?

Userlevel 7
Badge +1

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

 

Userlevel 7
Badge +3

 

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?

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.

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.

Userlevel 7
Badge +1

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?

Userlevel 7
Badge +3

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!

Userlevel 7
Badge +1

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.

Userlevel 7
Badge +3

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. 

Userlevel 7
Badge +3

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/

 

Userlevel 7
Badge +1

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? 

Userlevel 7
Badge +3

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!

Reply