Patch product by id (edit favourite)

PATCH /shops/@shop/products/@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
shop Int An integer value
id Int An integer value

Body

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

Field Type Description
favourite Bool A boolean value

Example request 1 Set a product to favourite

PATCH /shops/2899/products/6775 HTTP/1.1
Host: api.bakeronline.be
Authorization: Bearer ac89e3f5e321a7ad4c045eecab049356f5f6bb4545d9ee02c4d3bbd3a106ee06707895fcab087b0652ce7b4aab49aeec23b2f474cc38db83271facaa8b462b2ec165d8c345a59fd93d80ada8188b49aeeb855772bbd33f62af935ae8352f98b49bfb5f85
X-VERSION: 1.5.0
Accept-Language: en-US,en;q=0.5
Content-Type: application/json
Content-Length: 25
{
    "favourite": true
}

Example request 2 Set an only on isop product to favourite (as owner)

PATCH /shops/2899/products/6777 HTTP/1.1
Host: api.bakeronline.be
Authorization: Bearer 511aed53077b0000dcebb05c67e9c7bba785434bef452c09a61527e5bdc0b6ec45edfab5fa96f1e7b3249470e3ea036f2881239e32b7806eb052ad3f13eb3089604d9cc0645ec1feacb166aec0eac653cd0f3cc5e2d2c26b46157d0d406e57d22fe4f4ff
X-VERSION: 1.5.0
Accept-Language: en-US,en;q=0.5
Content-Type: application/json
Content-Length: 25
{
    "favourite": true
}

Example request 3 Cannot favourite an only on isop product

PATCH /shops/2899/products/6777 HTTP/1.1
Host: api.bakeronline.be
Authorization: Bearer ac89e3f5e321a7ad4c045eecab049356f5f6bb4545d9ee02c4d3bbd3a106ee06707895fcab087b0652ce7b4aab49aeec23b2f474cc38db83271facaa8b462b2ec165d8c345a59fd93d80ada8188b49aeeb855772bbd33f62af935ae8352f98b49bfb5f85
X-VERSION: 1.5.0
Accept-Language: en-US,en;q=0.5
Content-Type: application/json
Content-Length: 25
{
    "favourite": true
}

Example request 4 Set a product to favourite when it already is a favourite

PATCH /shops/2899/products/6775 HTTP/1.1
Host: api.bakeronline.be
Authorization: Bearer ac89e3f5e321a7ad4c045eecab049356f5f6bb4545d9ee02c4d3bbd3a106ee06707895fcab087b0652ce7b4aab49aeec23b2f474cc38db83271facaa8b462b2ec165d8c345a59fd93d80ada8188b49aeeb855772bbd33f62af935ae8352f98b49bfb5f85
X-VERSION: 1.5.0
Accept-Language: en-US,en;q=0.5
Content-Type: application/json
Content-Length: 25
{
    "favourite": true
}

Example request 5 Set a product to favourite when it already is a favourite and check if we don't have multiple favourites

PATCH /shops/2899/products/6775 HTTP/1.1
Host: api.bakeronline.be
Authorization: Bearer ac89e3f5e321a7ad4c045eecab049356f5f6bb4545d9ee02c4d3bbd3a106ee06707895fcab087b0652ce7b4aab49aeec23b2f474cc38db83271facaa8b462b2ec165d8c345a59fd93d80ada8188b49aeeb855772bbd33f62af935ae8352f98b49bfb5f85
X-VERSION: 1.5.0
Accept-Language: en-US,en;q=0.5
Content-Type: application/json
Content-Length: 25
{
    "favourite": true
}

Example request 6 Remove favourite

PATCH /shops/2899/products/6775 HTTP/1.1
Host: api.bakeronline.be
Authorization: Bearer ac89e3f5e321a7ad4c045eecab049356f5f6bb4545d9ee02c4d3bbd3a106ee06707895fcab087b0652ce7b4aab49aeec23b2f474cc38db83271facaa8b462b2ec165d8c345a59fd93d80ada8188b49aeeb855772bbd33f62af935ae8352f98b49bfb5f85
X-VERSION: 1.5.0
Accept-Language: en-US,en;q=0.5
Content-Type: application/json
Content-Length: 26
{
    "favourite": false
}

Example request 7 No permission to edit other fields

PATCH /shops/2899/products/6775 HTTP/1.1
Host: api.bakeronline.be
Authorization: Bearer ac89e3f5e321a7ad4c045eecab049356f5f6bb4545d9ee02c4d3bbd3a106ee06707895fcab087b0652ce7b4aab49aeec23b2f474cc38db83271facaa8b462b2ec165d8c345a59fd93d80ada8188b49aeeb855772bbd33f62af935ae8352f98b49bfb5f85
X-VERSION: 1.5.0
Accept-Language: en-US,en;q=0.5
Content-Type: application/json
Content-Length: 18
{
    "price": 0
}

Response

Field Type Description
id Int Id of the product
name String Name of the product (translated)
images [Image] Array of Image
price_type PriceType A product has a price type that defines the price calculations and the way consumers can order the product.
target_price Bool Is true when the price of the product can change on takeout (e.g. not exact weight)
price Price Price of the product (cents). It only makes sense to use this property when price_type is not multiple choice. Please also check if the shop where you want to order has an offer with a discount for this product available.
subtitle String? Nullable. Important text you need to display under the product name
description String Description of the product (translated)
allergens [Allergen]? Nullable. The allergens of this product. An empty array means no allergens. Null means no allergens specified (= can have allergens, ask in shop)
url URL? Nullable. An URL field starting with http:// or https://
url_type String String enumarion of 'none', 'recipe', 'website'
specialty Bool A boolean value
favourite Bool? Nullable. A boolean value
product_prices [ProductPrice.detailed] Array of ProductPrice.detailed
optionsets [OptionSet.detailed] Array of OptionSet.detailed
min_max MinMaxSummary An overview of the minimum and maximum values for all amount types.
info [Message] A list of messages with information you need to display on the product page.
offer OfferItem? Nullable. Specificies where a discount should get appllied. A shop can give a complete category a discount, or only a certain product, or only a fixed product price. When calculating the discount, always round the price to 1 cent before multiplying it with an amount, persons or kilograms.

Example response 1 Set a product to favourite

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

{
    "id": 6775,
    "name": "Wit brood gv",
    "price": {
        "value": 1874,
        "currency": "EUR"
    },
    "images": [
        {
            "resolutions": [
                {
                    "src": "https://bakeronline.be/uploads/tests/250x200/product-eclair-chocolade.jpg",
                    "width": 250,
                    "height": 250
                },
                {
                    "src": "https://bakeronline.be/uploads/tests/1080x720/product-eclair-chocolade.jpg",
                    "width": 1080,
                    "height": 1080
                }
            ],
            "white_background": true
        }
    ],
    "price_type": "PER_KILOGRAM",
    "target_price": true,
    "subtitle": null,
    "description": "",
    "allergens": null,
    "url": "http://www.carlier.be/quos-voluptate-velit-suscipit-ut-et-at-ipsam.html",
    "url_type": "website",
    "specialty": false,
    "favourite": true,
    "product_prices": [],
    "optionsets": [
        {
            "id": 7940,
            "name": "Do you want your bread sliced?",
            "code": null,
            "options": [
                {
                    "id": 27890,
                    "name": "Yes",
                    "price_change": {
                        "value": 624,
                        "currency": "EUR"
                    },
                    "image": null,
                    "require_image": false,
                    "code": null
                },
                {
                    "id": 27891,
                    "name": "Yes",
                    "price_change": {
                        "value": 408,
                        "currency": "EUR"
                    },
                    "image": null,
                    "require_image": false,
                    "code": null
                }
            ]
        }
    ],
    "min_max": {
        "amount": {
            "suggested": 1,
            "minimum": 1,
            "maximum": null
        },
        "weight": {
            "suggested": 100,
            "minimum": 1,
            "maximum": null
        },
        "persons": {
            "suggested": 1,
            "minimum": 1,
            "maximum": null
        }
    },
    "info": [
        {
            "name": "availability-takeout",
            "title": "6736",
            "text": "<p>3841</p>",
            "type": "HTML"
        },
        {
            "name": "availability-delivery",
            "title": "5674",
            "text": "<p>3841</p>",
            "type": "HTML"
        },
        {
            "name": "allergens",
            "title": "3882",
            "text": "2670",
            "type": "PLAIN"
        }
    ],
    "offer": null
}

Example response 2 Set an only on isop product to favourite (as owner)

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

{
    "id": 6777,
    "name": "Pain au chocolat",
    "price": {
        "value": 8563,
        "currency": "EUR"
    },
    "images": [
        {
            "resolutions": [
                {
                    "src": "https://bakeronline.be/uploads/tests/250x200/product-eclair-chocolade.jpg",
                    "width": 250,
                    "height": 250
                },
                {
                    "src": "https://bakeronline.be/uploads/tests/1080x720/product-eclair-chocolade.jpg",
                    "width": 1080,
                    "height": 1080
                }
            ],
            "white_background": true
        }
    ],
    "price_type": "PER_KILOGRAM",
    "target_price": false,
    "subtitle": null,
    "description": "",
    "allergens": [
        {
            "id": 1,
            "name": "1319"
        },
        {
            "id": 2,
            "name": "1320"
        },
        {
            "id": 4,
            "name": "1322"
        },
        {
            "id": 5,
            "name": "1323"
        },
        {
            "id": 8,
            "name": "1326"
        },
        {
            "id": 9,
            "name": "1327"
        },
        {
            "id": 11,
            "name": "1329"
        },
        {
            "id": 12,
            "name": "1330"
        },
        {
            "id": 13,
            "name": "1331"
        },
        {
            "id": 14,
            "name": "1332"
        },
        {
            "id": 15,
            "name": "1333"
        }
    ],
    "url": "http://www.masson.org/est-quaerat-mollitia-nihil-aut-et",
    "url_type": "recipe",
    "specialty": false,
    "favourite": true,
    "product_prices": [],
    "optionsets": [
        {
            "id": 7942,
            "name": "Extra baked?",
            "code": null,
            "options": [
                {
                    "id": 27894,
                    "name": "No thank you",
                    "price_change": {
                        "value": 524,
                        "currency": "EUR"
                    },
                    "image": null,
                    "require_image": false,
                    "code": null
                },
                {
                    "id": 27895,
                    "name": "No",
                    "price_change": {
                        "value": 599,
                        "currency": "EUR"
                    },
                    "image": null,
                    "require_image": false,
                    "code": null
                }
            ]
        }
    ],
    "min_max": {
        "amount": {
            "suggested": 1,
            "minimum": 1,
            "maximum": null
        },
        "weight": {
            "suggested": 100,
            "minimum": 1,
            "maximum": null
        },
        "persons": {
            "suggested": 1,
            "minimum": 1,
            "maximum": null
        }
    },
    "info": [
        {
            "name": "availability-takeout",
            "title": "6736",
            "text": "<p>3841</p>",
            "type": "HTML"
        },
        {
            "name": "availability-delivery",
            "title": "5674",
            "text": "<p>3841</p>",
            "type": "HTML"
        },
        {
            "name": "ingredients",
            "title": "3881",
            "text": "A list of ingredients here",
            "type": "PLAIN"
        },
        {
            "name": "allergens",
            "title": "3882",
            "text": "3883",
            "type": "PLAIN"
        }
    ],
    "offer": null
}

Example response 3 Cannot favourite an only on isop product

HTTP/1.1 404 Not Found
Content-Type: application/json; charset=utf-8
Content-Length: 71

{
    "code": "product_not_found",
    "message": "Product not found"
}

Example response 4 Set a product to favourite when it already is a favourite

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

{
    "id": 6775,
    "name": "Wit brood gv",
    "price": {
        "value": 1874,
        "currency": "EUR"
    },
    "images": [
        {
            "resolutions": [
                {
                    "src": "https://bakeronline.be/uploads/tests/250x200/product-eclair-chocolade.jpg",
                    "width": 250,
                    "height": 250
                },
                {
                    "src": "https://bakeronline.be/uploads/tests/1080x720/product-eclair-chocolade.jpg",
                    "width": 1080,
                    "height": 1080
                }
            ],
            "white_background": true
        }
    ],
    "price_type": "PER_KILOGRAM",
    "target_price": true,
    "subtitle": null,
    "description": "",
    "allergens": null,
    "url": "http://www.carlier.be/quos-voluptate-velit-suscipit-ut-et-at-ipsam.html",
    "url_type": "website",
    "specialty": false,
    "favourite": true,
    "product_prices": [],
    "optionsets": [
        {
            "id": 7940,
            "name": "Do you want your bread sliced?",
            "code": null,
            "options": [
                {
                    "id": 27890,
                    "name": "Yes",
                    "price_change": {
                        "value": 624,
                        "currency": "EUR"
                    },
                    "image": null,
                    "require_image": false,
                    "code": null
                },
                {
                    "id": 27891,
                    "name": "Yes",
                    "price_change": {
                        "value": 408,
                        "currency": "EUR"
                    },
                    "image": null,
                    "require_image": false,
                    "code": null
                }
            ]
        }
    ],
    "min_max": {
        "amount": {
            "suggested": 1,
            "minimum": 1,
            "maximum": null
        },
        "weight": {
            "suggested": 100,
            "minimum": 1,
            "maximum": null
        },
        "persons": {
            "suggested": 1,
            "minimum": 1,
            "maximum": null
        }
    },
    "info": [
        {
            "name": "availability-takeout",
            "title": "6736",
            "text": "<p>3841</p>",
            "type": "HTML"
        },
        {
            "name": "availability-delivery",
            "title": "5674",
            "text": "<p>3841</p>",
            "type": "HTML"
        },
        {
            "name": "allergens",
            "title": "3882",
            "text": "2670",
            "type": "PLAIN"
        }
    ],
    "offer": null
}

Example response 5 Set a product to favourite when it already is a favourite and check if we don't have multiple favourites

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

{
    "id": 6775,
    "name": "Wit brood gv",
    "price": {
        "value": 1874,
        "currency": "EUR"
    },
    "images": [
        {
            "resolutions": [
                {
                    "src": "https://bakeronline.be/uploads/tests/250x200/product-eclair-chocolade.jpg",
                    "width": 250,
                    "height": 250
                },
                {
                    "src": "https://bakeronline.be/uploads/tests/1080x720/product-eclair-chocolade.jpg",
                    "width": 1080,
                    "height": 1080
                }
            ],
            "white_background": true
        }
    ],
    "price_type": "PER_KILOGRAM",
    "target_price": true,
    "subtitle": null,
    "description": "",
    "allergens": null,
    "url": "http://www.carlier.be/quos-voluptate-velit-suscipit-ut-et-at-ipsam.html",
    "url_type": "website",
    "specialty": false,
    "favourite": true,
    "product_prices": [],
    "optionsets": [
        {
            "id": 7940,
            "name": "Do you want your bread sliced?",
            "code": null,
            "options": [
                {
                    "id": 27890,
                    "name": "Yes",
                    "price_change": {
                        "value": 624,
                        "currency": "EUR"
                    },
                    "image": null,
                    "require_image": false,
                    "code": null
                },
                {
                    "id": 27891,
                    "name": "Yes",
                    "price_change": {
                        "value": 408,
                        "currency": "EUR"
                    },
                    "image": null,
                    "require_image": false,
                    "code": null
                }
            ]
        }
    ],
    "min_max": {
        "amount": {
            "suggested": 1,
            "minimum": 1,
            "maximum": null
        },
        "weight": {
            "suggested": 100,
            "minimum": 1,
            "maximum": null
        },
        "persons": {
            "suggested": 1,
            "minimum": 1,
            "maximum": null
        }
    },
    "info": [
        {
            "name": "availability-takeout",
            "title": "6736",
            "text": "<p>3841</p>",
            "type": "HTML"
        },
        {
            "name": "availability-delivery",
            "title": "5674",
            "text": "<p>3841</p>",
            "type": "HTML"
        },
        {
            "name": "allergens",
            "title": "3882",
            "text": "2670",
            "type": "PLAIN"
        }
    ],
    "offer": null
}

Example response 6 Remove favourite

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

{
    "id": 6775,
    "name": "Wit brood gv",
    "price": {
        "value": 1874,
        "currency": "EUR"
    },
    "images": [
        {
            "resolutions": [
                {
                    "src": "https://bakeronline.be/uploads/tests/250x200/product-eclair-chocolade.jpg",
                    "width": 250,
                    "height": 250
                },
                {
                    "src": "https://bakeronline.be/uploads/tests/1080x720/product-eclair-chocolade.jpg",
                    "width": 1080,
                    "height": 1080
                }
            ],
            "white_background": true
        }
    ],
    "price_type": "PER_KILOGRAM",
    "target_price": true,
    "subtitle": null,
    "description": "",
    "allergens": null,
    "url": "http://www.carlier.be/quos-voluptate-velit-suscipit-ut-et-at-ipsam.html",
    "url_type": "website",
    "specialty": false,
    "favourite": false,
    "product_prices": [],
    "optionsets": [
        {
            "id": 7940,
            "name": "Do you want your bread sliced?",
            "code": null,
            "options": [
                {
                    "id": 27890,
                    "name": "Yes",
                    "price_change": {
                        "value": 624,
                        "currency": "EUR"
                    },
                    "image": null,
                    "require_image": false,
                    "code": null
                },
                {
                    "id": 27891,
                    "name": "Yes",
                    "price_change": {
                        "value": 408,
                        "currency": "EUR"
                    },
                    "image": null,
                    "require_image": false,
                    "code": null
                }
            ]
        }
    ],
    "min_max": {
        "amount": {
            "suggested": 1,
            "minimum": 1,
            "maximum": null
        },
        "weight": {
            "suggested": 100,
            "minimum": 1,
            "maximum": null
        },
        "persons": {
            "suggested": 1,
            "minimum": 1,
            "maximum": null
        }
    },
    "info": [
        {
            "name": "availability-takeout",
            "title": "6736",
            "text": "<p>3841</p>",
            "type": "HTML"
        },
        {
            "name": "availability-delivery",
            "title": "5674",
            "text": "<p>3841</p>",
            "type": "HTML"
        },
        {
            "name": "allergens",
            "title": "3882",
            "text": "2670",
            "type": "PLAIN"
        }
    ],
    "offer": null
}

Example response 7 No permission to edit other fields

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

[
    {
        "code": "unknown_field",
        "message": "Field price is not expected",
        "field": "data"
    }
]
Version update available Please adjust your integration to the latest stable version (1.5.2)
1.5.0 stable