Manage product categories
After accessing the eCommerce platform you can start defining the categories that your products will be associated to. Note that this should ideally be the first object type you import into your account.
Create a category
To create a category, go to the eCommerce > Create/Update a category in the API reference. Below you find an example of body parameters which can be used to create or update a category.
cURL Request
The cURL request shows us what parameters will be used to create a category. Below, you can see some default values mentioned for each parameter.
Body parameters
Update a category
You can update a category by changing the boolean value to true in the updateEnabled attribute when you are creating the category.
You can then change the name and url of the category and then run it to update the respective category.
Response codes
Retrieving all categories
You can retrieve the categories you added by calling the eCommerce > Return all your categories API endpoint in the API reference. Below you can see the attributes used for returning all your categories.
cURL Request
The parameters to retrieve all categories are as following:
Retrieving a category details
You can get a category’s details by entering the id for the category in the get a category details endpoint.
There is only one attribute for this endpoint mentioned below:
Creating categories in a batch
You can use this to send your product categories in batches so you don’t have to add every category individually. Below you can find a cURL request for creating categories in a batch.
We can use the cURL request to call the batch endpoint for categories. Note the boolean attribute updateEnabled is included to enable or disable updates for all the categories being imported.
Categories is an array of objects. It has further sub-attributes.
JSON Payload
Good practices for importing category batches
- You can create up to 100 categories per call . The sub-attributes for categories are same as the attributes in create a category above.
- Be sure to add the proper category url to the JSON payload.
- All the attributes have the data type as string.