Download PDF
Download page Use Case: Browsing the Catalog.
Use Case: Browsing the Catalog
A Catalog is a view that allows hierarchical categorization of products for you to search through products. This use case describes how to browse through a catalog. It helps you explore the products before you add them to the cart. There are multiple ways you can search and find the product you are looking for. Implementation teams can use these APIs to filter products by their characteristics, sort products by fields associated with them, apply pagination to the results, and use other such functionalities to navigate the catalog.
Getting the Category Tree for a Price List
You can retrieve all or a filtered list of categories based on provided parameters. For example, pass the price list ID to retrieve all categories associated with that price list ID.
Prerequisite
You must have price list ID to retrieve the categories associated with it.
Example
The following table lists the API method, endpoint, and path as well as a sample request and response to get the category tree for a price list.
Method | GET | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Endpoint | /categories | ||||||||||
Request Parameter | The following URL parameters are used to narrow down the search result to specifically retrieve categories associated with a price list ID.
| ||||||||||
Request URL | https://<URL_of_the_Instance>/api/catalog/v1/categories?includes=products&page=1&limit=100 | ||||||||||
Request Body | The following sample code enables you to get the category tree for the given price list and based on the other above-mentioned parameters.
CODE
| ||||||||||
Response | The API returns the list of categories with details such as Category ID, Category Name, Description, Hierarchy ID, and the category's parent and child categories. Response Body
CODE
|
Getting the Products in a Category
You can retrieve all active products associated with the provided category ID and price list ID. This can be the ID of the leaf category, sub-category, or root category.
Prerequisite
You must have a price list ID and the category ID.
Example 1
The following table lists the API method, endpoint, and path as well as a sample request and response to get all products associated with a category and the corresponding price list.
Method | GET | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Endpoint | /categories/{categoryId}/products | ||||||||||
Request URL | The following URL parameters are used to narrow down the search result to specifically retrieve products associated with a category ID and a price list ID.
| ||||||||||
Request | The following sample code enables you to get the products associated with the given price list and category, adhering to the other above-mentioned parameters.
CODE
| ||||||||||
Response | For a leaf category, the API returns all products associated with it. If the ID of the root or sub-category (not a leaf category ID) is provided, the API returns all the products associated with all child categories. Response Body
CODE
|
Example 2
The following table lists the API method, endpoint, and path as well as a sample request and response to get a product having a specific name and are associated with a category and a corresponding price list.
Method | GET | ||||||||
---|---|---|---|---|---|---|---|---|---|
Endpoint | /categories/{categoryId}/products | ||||||||
Request URL | The following URL parameters are used to narrow down the search result to specifically retrieve products with the name "ACS_System_Installer" associated with a category ID and a price list ID.
| ||||||||
Request | The following sample code enables you to get the products associated with the given price list and category, adhering to the other above-mentioned parameters.
CODE
| ||||||||
Response | For a leaf category, the API returns all products associated with it. If the ID of the root or sub-category (not a leaf category ID) is provided, the API returns all the products associated with all child categories. Response Body
CODE
|
Example 3
The following table lists the API method, endpoint, and path as well as a sample request and response to get only standalone products associated with a category and a corresponding price list.
Method | GET | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Endpoint | /categories/{categoryId}/products | ||||||||||||
Request URL | The following URL parameters are used to narrow down the search result to specifically retrieve the 1st standalone product on the third page that is associated with a category ID and a price list ID.
| ||||||||||||
Request | The following sample code enables you to get the products associated with the given price list and category, adhering to the other above-mentioned parameters.
CODE
| ||||||||||||
Response | For a leaf category, the API returns all products associated with it. If the ID of the root or sub-category (not a leaf category ID) is provided, the API returns all the products associated with all child categories. Response Body
CODE
|