Categories allow merchants to group products of various types together to display them in a logical way to customers. This area of the API allows you to manage how that is done.
The following pre-requisites will be necessary to accomplish the goals of this article:
- General understanding of REST and API’s
If you haven’t already done so, you should probably have a development environment ready to development against, complete with Hotcakes installed and configured.
REST API endpoints for Categories
There are a handful of REST API endpoints that allow you to display or manage various aspects of categories. Those endpoints are detailed below.
|CategoriesClearAll||Boolean||Deletes all of the categories in the store, provided that this has been allowed in the store admin API page.|
|CategoriesCreate||CategoryDTO||Creates the category with the provided attributes and returns the object back to you.|
|CategoriesDelete||Boolean||Deletes the category matching the given category ID and returns true if successful.|
|CategoriesFind||CategoryDTO||Returns any category matching the category ID provided.|
|CategoriesFindAll||List of CategorySnapshotDTO||Returns a list of categories for the store sorted the same as you have sorted in the store admin area.|
|CategoriesFindBySlug||CategoryDTO||Returns the category that matches the URL slug provided.|
|CategoriesFindForProduct||List of CategorySnapshotDTO||Returns all of the categories that the specified product belongs to in the store.|
|CategoriesUpdate||CategoryDTO||Updates the category matching the given ID with the provided attributes and returns the object back to you.|