Backend API
Update an existing category.
Arguments
The unique identifier of the category.
Set true to make the category visible to customers in a storefront, otherwise, it will be hidden from view.
A long-form description of the category, often containing HTML or other markup languages.
Images depicting the category.
A brief description of the image.
An object representing the image file.
Set or overwrite file data. Use the following format when writing a file from binary data (for example an image): data[$binary]=<base64 encoded binary daya>.
Optional file name.
List of images depicting the category.
A human-friendly name for the category.
Price rules to override price and sale_price when conditions match quantity or account group in a cart. Overrides product prices.
Price applied when conditions are met.
Customer account group as a condition to apply price.
Maximum quantity as a condition to apply price.
Minimum quantity as a condition to apply price.
Indicates the variant is on sale and sale_price is used by default when the product is added to a cart. Overrides product sale.
Sale price used by default when sale=true, overriding price. Overrides product sale price.
If specified, shipping is calculated based on this shipping weight. Otherwise, it will assume 1 lb/oz/kg depending on your default weight unit. Overrides product shipping weight.
Stock keeping unit (SKU) used to track inventory in a warehouse.
Unique identifier typically used in URLs. Defaults to name converted to lowercase and hyphenated. If the category has a parent, the default slug will be prefixed with the parent slug. Maximum length of 1,000 characters.
const { swell } = require('swell-node');
swell.init('store-id', 'secret-key');
await swell.put('/categories/{id}', {
id: '5ca9871f9b14d199072432a1',
description: 'A bunch of widgets',
active: false
});
Response
{
"id": "5ca9871f9b14d199072432a1",
"active": false,
"name": "Widgets",
"slug": "widgets",
"date_created": "2019-04-01T00:00:00.000Z"
"date_updated": "2019-04-01T00:00:00.000Z",
"description": 'A bunch of widgets',
"images": [
{
"id": "5ca24abb9c077817e5fe2b37",
"file": {
"id": "5ca24abb9c077817e5fe2b38",
"date_uploaded": "2019-04-02T00:26:23.399Z",
"length": 66764,
"md5": "99194f53bfdea832553e7fa8ae8fd80f",
"content_type": "image/png",
"url": "http://cdn.swell.store/test/5ca24abb9c077817e5fe2b36/99194f53bfdea832553e7fa8ae8fd80f",
"width": 940,
"height": 600
}
}
],
"meta_title": null,
"meta_keywords": null,
"meta_description": null
}