Update a category

PATCH /company/categories/@id

Request

Authentication

This endpoint requires authentication.

Header Value
Authorization Set the value to Bearer + + access_token

URL parameters

Replace the @ keywords in the URL with their corresponding value.

A dictionary with fields

Field Type Description
id Int The ID of the category you want to update

Body

Pass the following properties via application/json or form encoding in the body of the request.

Field Type Description
name [Language: String] Translated category name
description [Language: String] Description of this category
active Bool A boolean value
only_order_in_store Bool Whether this product can only get ordered in the store with a separate UI for the shop employees, and not in the public webshop
shop_ids [Int] Minimum 1. IDs of the shops the category will be available for
seo company.SeoData Optional. The category's webpage search engine metatags
product_ids [Int] Optional. Set the order of the products in a category by setting the IDs of the products in the right order. You can't add or remove products, only change the order. Don't set this field if you don't want to make changes.

Example request 1 Update basic category

PATCH /company/categories/269 HTTP/1.1
Host: api.bakeronline.be
Authorization: Bearer cfc719c25df82a8fb91796aea18e4c0ae779aec0fdaff29876b9ba35fc42e2c17e6507fbc8798672bb6cea5d6c49c95ef0f1197c135fa7d84043b4dce717e60265bc163661ff1bb3301bb5c8ed2c95c0a3e8d47a335d898ad3f22cd894e2ff77a4d08012
X-VERSION: 1.5.0
Accept-Language: en-US,en;q=0.5
Content-Type: application/json
Content-Length: 287
{
    "name": {
        "nl": "Groot",
        "en": "Big",
        "fr": "Grand"
    },
    "description": {
        "nl": "Groot",
        "en": "Big",
        "fr": "Grand"
    },
    "active": true,
    "only_order_in_store": false,
    "shop_ids": [
        158,
        157
    ]
}

Example request 2 Update product order

PATCH /company/categories/269 HTTP/1.1
Host: api.bakeronline.be
Authorization: Bearer cfc719c25df82a8fb91796aea18e4c0ae779aec0fdaff29876b9ba35fc42e2c17e6507fbc8798672bb6cea5d6c49c95ef0f1197c135fa7d84043b4dce717e60265bc163661ff1bb3301bb5c8ed2c95c0a3e8d47a335d898ad3f22cd894e2ff77a4d08012
X-VERSION: 1.5.0
Accept-Language: en-US,en;q=0.5
Content-Type: application/json
Content-Length: 118
{
    "product_ids": [
        419,
        421,
        420
    ],
    "shop_ids": [
        158,
        157
    ]
}

Example request 3 Update products should contain exactly the same product ids

PATCH /company/categories/269 HTTP/1.1
Host: api.bakeronline.be
Authorization: Bearer cfc719c25df82a8fb91796aea18e4c0ae779aec0fdaff29876b9ba35fc42e2c17e6507fbc8798672bb6cea5d6c49c95ef0f1197c135fa7d84043b4dce717e60265bc163661ff1bb3301bb5c8ed2c95c0a3e8d47a335d898ad3f22cd894e2ff77a4d08012
X-VERSION: 1.5.0
Accept-Language: en-US,en;q=0.5
Content-Type: application/json
Content-Length: 92
{
    "product_ids": [
        421
    ],
    "shop_ids": [
        158,
        157
    ]
}

Example request 4 Update products can not add products of other categories

PATCH /company/categories/269 HTTP/1.1
Host: api.bakeronline.be
Authorization: Bearer cfc719c25df82a8fb91796aea18e4c0ae779aec0fdaff29876b9ba35fc42e2c17e6507fbc8798672bb6cea5d6c49c95ef0f1197c135fa7d84043b4dce717e60265bc163661ff1bb3301bb5c8ed2c95c0a3e8d47a335d898ad3f22cd894e2ff77a4d08012
X-VERSION: 1.5.0
Accept-Language: en-US,en;q=0.5
Content-Type: application/json
Content-Length: 131
{
    "product_ids": [
        419,
        421,
        420,
        422
    ],
    "shop_ids": [
        158,
        157
    ]
}

Response

Field Type Description
name [Language: String] Translated category name
description [Language: String] Description of this category
active Bool A boolean value
only_order_in_store Bool Whether this product can only get ordered in the store with a separate UI for the shop employees, and not in the public webshop
products [company.Product.simple] Array of company.Product.simple
shops [company.Shop.simple] Array of company.Shop.simple
id Int ID of the category
banner Image? Nullable.
seo company.SeoData Optional. The category's webpage search engine metatags

Example response 1 Update basic category

HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
Content-Length: 8392

{
    "id": 269,
    "name": {
        "en": "Big",
        "fr": "Grand",
        "nl": "Groot"
    },
    "description": {
        "en": "Big",
        "fr": "Grand",
        "nl": "Groot"
    },
    "banner": null,
    "active": true,
    "only_order_in_store": false,
    "seo": {
        "title": [],
        "description": [],
        "url": []
    },
    "products": [
        {
            "id": 419,
            "name": {
                "nl": "Pistolets tijger"
            },
            "description": {
                "nl": ""
            },
            "specialty": false,
            "active": true,
            "only_order_in_store": false,
            "allergens": [
                {
                    "id": 3,
                    "name": "1321"
                },
                {
                    "id": 5,
                    "name": "1323"
                },
                {
                    "id": 13,
                    "name": "1331"
                },
                {
                    "id": 14,
                    "name": "1332"
                },
                {
                    "id": 15,
                    "name": "1333"
                }
            ],
            "price_look_up_code": "181878",
            "price_type": "PER_KILOGRAM",
            "price": 389,
            "target_price": false,
            "url_type": "recipe",
            "url": "http://lambrechts.be/fugiat-alias-odio-in-labore-rerum-accusamus-ad",
            "min_max": {
                "amount": {
                    "minimum": 0,
                    "maximum": null,
                    "maximum_day": null,
                    "maximum_week": null
                },
                "weight": {
                    "minimum": 0,
                    "maximum": null,
                    "maximum_day": null,
                    "maximum_week": null,
                    "suggested": null
                },
                "persons": {
                    "minimum": 0,
                    "maximum": null
                }
            },
            "seo": {
                "title": [],
                "description": [],
                "url": []
            },
            "code": "75252",
            "category_id": 269
        },
        {
            "id": 420,
            "name": {
                "nl": "Boterkoek met rozijnen"
            },
            "description": {
                "nl": "Random product description"
            },
            "specialty": false,
            "active": true,
            "only_order_in_store": false,
            "allergens": [],
            "price_look_up_code": "312158",
            "price_type": "PER_PERSON",
            "price": 3107,
            "target_price": false,
            "url_type": "website",
            "url": "https://lemmens.com/enim-sit-quia-sunt.html",
            "min_max": {
                "amount": {
                    "minimum": 1,
                    "maximum": null,
                    "maximum_day": null,
                    "maximum_week": null
                },
                "weight": {
                    "minimum": 0,
                    "maximum": null,
                    "maximum_day": null,
                    "maximum_week": null,
                    "suggested": null
                },
                "persons": {
                    "minimum": 0,
                    "maximum": null
                }
            },
            "seo": {
                "title": [],
                "description": [],
                "url": []
            },
            "code": null,
            "category_id": 269
        },
        {
            "id": 421,
            "name": {
                "nl": "Kaiser pistolet"
            },
            "description": {
                "nl": "Random product description"
            },
            "specialty": false,
            "active": true,
            "only_order_in_store": false,
            "allergens": [
                {
                    "id": 1,
                    "name": "1319"
                },
                {
                    "id": 2,
                    "name": "1320"
                },
                {
                    "id": 3,
                    "name": "1321"
                },
                {
                    "id": 5,
                    "name": "1323"
                },
                {
                    "id": 6,
                    "name": "1324"
                },
                {
                    "id": 7,
                    "name": "1325"
                },
                {
                    "id": 8,
                    "name": "1326"
                },
                {
                    "id": 9,
                    "name": "1327"
                },
                {
                    "id": 11,
                    "name": "1329"
                },
                {
                    "id": 12,
                    "name": "1330"
                },
                {
                    "id": 13,
                    "name": "1331"
                },
                {
                    "id": 15,
                    "name": "1333"
                }
            ],
            "price_look_up_code": "694766",
            "price_type": "MULTIPLE_CHOICE",
            "price": 9422,
            "target_price": false,
            "url_type": "recipe",
            "url": "http://goffin.be/vel-qui-aut-ratione-omnis-ex-a-explicabo-dolore",
            "min_max": {
                "amount": {
                    "minimum": 0,
                    "maximum": null,
                    "maximum_day": null,
                    "maximum_week": null
                },
                "weight": {
                    "minimum": 0,
                    "maximum": null,
                    "maximum_day": null,
                    "maximum_week": null,
                    "suggested": null
                },
                "persons": {
                    "minimum": 0,
                    "maximum": null
                }
            },
            "seo": {
                "title": [],
                "description": [],
                "url": []
            },
            "code": "573183",
            "category_id": 269
        }
    ],
    "shops": [
        {
            "id": 157,
            "name": "Mad Batters",
            "active": true,
            "address": {
                "street": "Claeyshof",
                "nr": "50",
                "zipcode": "5500",
                "city": "Namen",
                "country": "BE",
                "position": {
                    "latitude": 50.8503396,
                    "longitude": 4.3517103
                }
            },
            "avatar": {
                "resolutions": [
                    {
                        "src": "https://bakeronline.be/uploads/shop-avatars/157/180x180/brood-en-banket-casteur.jpg",
                        "width": 271,
                        "height": 180
                    },
                    {
                        "src": "https://bakeronline.be/uploads/shop-avatars/157/360x360/brood-en-banket-casteur.jpg",
                        "width": 300,
                        "height": 199
                    }
                ]
            },
            "banner": null,
            "allow_comments": true,
            "allow_orders": true,
            "delivery_use_intervals": false
        },
        {
            "id": 158,
            "name": "Knead for Sweets",
            "active": true,
            "address": {
                "street": "Verhaeghehof",
                "nr": "89",
                "zipcode": "4770",
                "city": "Mortsel",
                "country": "BE",
                "position": {
                    "latitude": 51.05,
                    "longitude": 3.71667
                }
            },
            "avatar": null,
            "banner": {
                "resolutions": [
                    {
                        "src": "https://bakeronline.be/uploads/banner/158/1300x315/patisserie-diva.jpg",
                        "width": 300,
                        "height": 200
                    }
                ]
            },
            "allow_comments": true,
            "allow_orders": true,
            "delivery_use_intervals": false
        }
    ]
}

Example response 2 Update product order

HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
Content-Length: 8392

{
    "id": 269,
    "name": {
        "en": "Big",
        "fr": "Grand",
        "nl": "Groot"
    },
    "description": {
        "en": "Big",
        "fr": "Grand",
        "nl": "Groot"
    },
    "banner": null,
    "active": true,
    "only_order_in_store": false,
    "seo": {
        "title": [],
        "description": [],
        "url": []
    },
    "products": [
        {
            "id": 419,
            "name": {
                "nl": "Pistolets tijger"
            },
            "description": {
                "nl": ""
            },
            "specialty": false,
            "active": true,
            "only_order_in_store": false,
            "allergens": [
                {
                    "id": 3,
                    "name": "1321"
                },
                {
                    "id": 5,
                    "name": "1323"
                },
                {
                    "id": 13,
                    "name": "1331"
                },
                {
                    "id": 14,
                    "name": "1332"
                },
                {
                    "id": 15,
                    "name": "1333"
                }
            ],
            "price_look_up_code": "181878",
            "price_type": "PER_KILOGRAM",
            "price": 389,
            "target_price": false,
            "url_type": "recipe",
            "url": "http://lambrechts.be/fugiat-alias-odio-in-labore-rerum-accusamus-ad",
            "min_max": {
                "amount": {
                    "minimum": 0,
                    "maximum": null,
                    "maximum_day": null,
                    "maximum_week": null
                },
                "weight": {
                    "minimum": 0,
                    "maximum": null,
                    "maximum_day": null,
                    "maximum_week": null,
                    "suggested": null
                },
                "persons": {
                    "minimum": 0,
                    "maximum": null
                }
            },
            "seo": {
                "title": [],
                "description": [],
                "url": []
            },
            "code": "75252",
            "category_id": 269
        },
        {
            "id": 421,
            "name": {
                "nl": "Kaiser pistolet"
            },
            "description": {
                "nl": "Random product description"
            },
            "specialty": false,
            "active": true,
            "only_order_in_store": false,
            "allergens": [
                {
                    "id": 1,
                    "name": "1319"
                },
                {
                    "id": 2,
                    "name": "1320"
                },
                {
                    "id": 3,
                    "name": "1321"
                },
                {
                    "id": 5,
                    "name": "1323"
                },
                {
                    "id": 6,
                    "name": "1324"
                },
                {
                    "id": 7,
                    "name": "1325"
                },
                {
                    "id": 8,
                    "name": "1326"
                },
                {
                    "id": 9,
                    "name": "1327"
                },
                {
                    "id": 11,
                    "name": "1329"
                },
                {
                    "id": 12,
                    "name": "1330"
                },
                {
                    "id": 13,
                    "name": "1331"
                },
                {
                    "id": 15,
                    "name": "1333"
                }
            ],
            "price_look_up_code": "694766",
            "price_type": "MULTIPLE_CHOICE",
            "price": 9422,
            "target_price": false,
            "url_type": "recipe",
            "url": "http://goffin.be/vel-qui-aut-ratione-omnis-ex-a-explicabo-dolore",
            "min_max": {
                "amount": {
                    "minimum": 0,
                    "maximum": null,
                    "maximum_day": null,
                    "maximum_week": null
                },
                "weight": {
                    "minimum": 0,
                    "maximum": null,
                    "maximum_day": null,
                    "maximum_week": null,
                    "suggested": null
                },
                "persons": {
                    "minimum": 0,
                    "maximum": null
                }
            },
            "seo": {
                "title": [],
                "description": [],
                "url": []
            },
            "code": "573183",
            "category_id": 269
        },
        {
            "id": 420,
            "name": {
                "nl": "Boterkoek met rozijnen"
            },
            "description": {
                "nl": "Random product description"
            },
            "specialty": false,
            "active": true,
            "only_order_in_store": false,
            "allergens": [],
            "price_look_up_code": "312158",
            "price_type": "PER_PERSON",
            "price": 3107,
            "target_price": false,
            "url_type": "website",
            "url": "https://lemmens.com/enim-sit-quia-sunt.html",
            "min_max": {
                "amount": {
                    "minimum": 1,
                    "maximum": null,
                    "maximum_day": null,
                    "maximum_week": null
                },
                "weight": {
                    "minimum": 0,
                    "maximum": null,
                    "maximum_day": null,
                    "maximum_week": null,
                    "suggested": null
                },
                "persons": {
                    "minimum": 0,
                    "maximum": null
                }
            },
            "seo": {
                "title": [],
                "description": [],
                "url": []
            },
            "code": null,
            "category_id": 269
        }
    ],
    "shops": [
        {
            "id": 157,
            "name": "Mad Batters",
            "active": true,
            "address": {
                "street": "Claeyshof",
                "nr": "50",
                "zipcode": "5500",
                "city": "Namen",
                "country": "BE",
                "position": {
                    "latitude": 50.8503396,
                    "longitude": 4.3517103
                }
            },
            "avatar": {
                "resolutions": [
                    {
                        "src": "https://bakeronline.be/uploads/shop-avatars/157/180x180/brood-en-banket-casteur.jpg",
                        "width": 271,
                        "height": 180
                    },
                    {
                        "src": "https://bakeronline.be/uploads/shop-avatars/157/360x360/brood-en-banket-casteur.jpg",
                        "width": 300,
                        "height": 199
                    }
                ]
            },
            "banner": null,
            "allow_comments": true,
            "allow_orders": true,
            "delivery_use_intervals": false
        },
        {
            "id": 158,
            "name": "Knead for Sweets",
            "active": true,
            "address": {
                "street": "Verhaeghehof",
                "nr": "89",
                "zipcode": "4770",
                "city": "Mortsel",
                "country": "BE",
                "position": {
                    "latitude": 51.05,
                    "longitude": 3.71667
                }
            },
            "avatar": null,
            "banner": {
                "resolutions": [
                    {
                        "src": "https://bakeronline.be/uploads/banner/158/1300x315/patisserie-diva.jpg",
                        "width": 300,
                        "height": 200
                    }
                ]
            },
            "allow_comments": true,
            "allow_orders": true,
            "delivery_use_intervals": false
        }
    ]
}

Example response 3 Update products should contain exactly the same product ids

HTTP/1.1 400 Bad Request
Content-Type: application/json; charset=utf-8
Content-Length: 132

{
    "code": "invalid_field",
    "message": "Number of product_ids does not match category products",
    "field": "product_ids"
}

Example response 4 Update products can not add products of other categories

HTTP/1.1 400 Bad Request
Content-Type: application/json; charset=utf-8
Content-Length: 132

{
    "code": "invalid_field",
    "message": "Number of product_ids does not match category products",
    "field": "product_ids"
}
1.5.0 stable