Create a category

POST /company/companies/@id/categories

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 company where to create a new category

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 Create basic category

POST /company/companies/153/categories HTTP/1.1
Host: api.bakeronline.be
Authorization: Bearer f5e4f5fd4f677e9cc6e4c927c068d96488703ce897108455829cacecfacd399de2394ba383afa20892630d58e62d311d0e640bb8cc01ddf2922c31b9522504a48adf292a5a3621e2c963894e584f3d3491df93cc60f2369166ea20091006c280c3f2c7e5
X-VERSION: 1.5.0
Accept-Language: en-US,en;q=0.5
Content-Type: application/json
Content-Length: 230
{
    "name": {
        "es": "Grand"
    },
    "description": {
        "nl": "Groot",
        "en": "Big",
        "fr": "Grand"
    },
    "active": true,
    "only_order_in_store": false,
    "shop_ids": [
        156
    ]
}

Example request 2 Creating a category should have minimum 1 shop

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

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 Create basic category

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

{
    "id": 268,
    "name": {
        "es": "Grand",
        "nl": ""
    },
    "description": {
        "en": "Big",
        "fr": "Grand",
        "nl": "Groot"
    },
    "banner": null,
    "active": true,
    "only_order_in_store": false,
    "seo": {
        "title": [],
        "description": [],
        "url": []
    },
    "products": [],
    "shops": [
        {
            "id": 156,
            "name": "Best Thing Since Sliced Bread",
            "active": true,
            "address": {
                "street": "Jacquesweg",
                "nr": "24",
                "zipcode": "9860",
                "city": "Fontaine-l'Evêque",
                "country": "BE",
                "position": {
                    "latitude": 50.8503396,
                    "longitude": 4.3517103
                }
            },
            "avatar": {
                "resolutions": [
                    {
                        "src": "https://bakeronline.be/uploads/shop-avatars/156/180x180/slagerij-traiteur-van-vlaenderen.jpg",
                        "width": 237,
                        "height": 180
                    },
                    {
                        "src": "https://bakeronline.be/uploads/shop-avatars/156/360x360/slagerij-traiteur-van-vlaenderen.jpg",
                        "width": 300,
                        "height": 228
                    }
                ]
            },
            "banner": {
                "resolutions": [
                    {
                        "src": "https://bakeronline.be/uploads/banner/156/1300x315/bakkerij-baeten-maaseik.jpg",
                        "width": 300,
                        "height": 200
                    }
                ]
            },
            "allow_comments": true,
            "allow_orders": true,
            "delivery_use_intervals": false
        }
    ]
}

Example response 2 Creating a category should have minimum 1 shop

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

[
    {
        "code": "invalid_length",
        "message": "Expected an array with minimum 1",
        "field": "data.shop_ids"
    }
]
1.5.0 stable