Introduction
Most items in the platform that can be created, edited, or deleted have a unique ID. This ID is essential for performing API actions on those items. For example, if you want to view course data using the API endpoint GET /learn/v1/courses/{course_id}, you need the course ID to make the request.
This article explains how to retrieve unique IDs, such as user IDs, course IDs, and catalog IDs, which are required for performing API actions and accessing data. It provides methods and examples for how to obtain these IDs through API endpoints, using the API browser.
Retrieve IDs directly from the platform
The most common IDs platform administrators utilize are user IDs and course IDs. These can be retrieved directly from the platform.
- User IDs: You can find them by generating a Users custom report
- Course IDs: You can obtain them through an export of the course data in CSV or XLS format from the Course management page
For extra details on how to recover IDs directly from the Docebo platform interface, this Community article on finding unique IDs (opens in a new tab) can be helpful.
In the next chapter we will see how, by using APIs, we can retrieve IDs not just for users and courses, but also for catalogs, learning plans, notifications, and more.
Retrieve IDs using the API browser
When IDs cannot be retrieved via the platform interface, some GET API endpoints can help. Here’s how to do it:
Check the response sample
Before launching the endpoint, check the response sample to ensure it includes the ID you need. The sample shows what data the API will return.
Launch the endpoint
After verifying that the endpoint provides the needed ID, such as a course ID, you can launch the appropriate API (e.g. GET/learn/v1/courses). Remember to authenticate as described in the article Get started with the Docebo API browser.
Retrieve catalog IDs
To retrieve catalog IDs, you can follow a similar approach, but taking into consideration some differences with other endpoints.
Find the endpoint and validate the response schema
As explained earlier, reviewing the response schema helps determine if the endpoint returns the ID you're looking for. Typically, the ID appears at the top of the response. However, for catalog IDs, it is usually located toward the end of each item in the response. The table below highlights this difference:
Returns all Courses | Retrieves some content for all the given catalogs |
Launch the Catalog endpoint
Keep in mind: When using the API, the returned list of catalog content depends on the course settings and catalog visibility rules for the user making the request. If a catalog is not visible or has not been associated with the requesting user, it will not appear in the results.
To retrieve catalog information within this scope, use the endpoint:
- GET/learn/v1/catalog_content/internal/preview
Scope the results
When using the API to retrieve catalog IDs, you can limit the number of results to just one to quickly access the course ID. This makes it easier to find the information you need. Keep in mind that only catalogs with associated courses or learning plans will be returned.
Authenticate and launch the endpoint
Authenticate as described in the article article Get started with the Docebo API browser. Then use the Try button to send your request.
Identify the catalog ID in the response
Once the response is displayed, identify the catalog ID. Look for the extra_data
field, where the catalog ID integer will be displayed:
Example: Use a catalog ID to retrieve a given catalog information
To retrieve details about a specific catalog, use the following endpoint:
-
GET/learn/v1/catalog_content/internal/{catalog_id}.
This will provide all the content linked to that one catalog.
Identify the endpoint and its requirements
Endpoint: get/learn/v1/catalog_content/internal/{catalog_id}
Requirements: catalog_id
is a required parameter
Retrieve the Catalog ID
Use the endpoint GET/learn/v1/catalog_content/internal/preview to get the catalog ID, as described in the preceding chapter.
Once you have the ID of the desired catalog, you can input it as a parameter for the endpoint get/learn/v1/catalog_content/internal/{catalog_id}
Authenticate and launch the endpoint
After authenticating, you can click Try to launch the endpoint.
The results will include the total number of courses in the catalog and detailed information for each course. The response structure is fixed and cannot be customized.
By following these steps, you can efficiently retrieve and use IDs within the platform to interact with its various components using APIs.