Create one or multiple VAT changes in a company

POST /company/companies/@id/vat-changes

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 Change the VAT in a given company

Body

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

Array of company.VATChange: [company.VATChange]

company.VATChange

Field Type Description
product_id Int? Nullable. The ID of the product where this VAT percentage is applied.
product_price_id Int? Nullable. The ID of the product price where this VAT percentage is applied.
product_option_id Int? Nullable. The ID of the product option where this VAT percentage is applied.
percentage Float The VAT percentage
method String The take out method for which this VAT percentage should get applied
start_date Date? Nullable. When this VAT percentage will take effect. Use null to apply since the beginning.

Example request 1 Create one VAT change for a product

POST /company/companies/204/vat-changes HTTP/1.1
Host: api.bakeronline.be
Authorization: Bearer 9cb5e0ccf0325a257ff9811df033b489915b575961b3abbffb2d180ba2b19f9749a73a16754f1adb1cfab5ae21f0c70e12fe1742bde553fb7662b5def819a8e132afb09a4b50c32a2094a2c64a2ecd99cbbe8d2da4fea704f39a94aae0afd8e8490189ce
X-VERSION: 1.5.0
Accept-Language: en-US,en;q=0.5
Content-Type: application/json
Content-Length: 196
[
    {
        "product_id": 574,
        "product_price_id": null,
        "product_option_id": null,
        "percentage": 21.85,
        "method": "takeout",
        "start_date": null
    }
]

Example request 2 Create multiple VAT changes for a product

POST /company/companies/204/vat-changes HTTP/1.1
Host: api.bakeronline.be
Authorization: Bearer 9cb5e0ccf0325a257ff9811df033b489915b575961b3abbffb2d180ba2b19f9749a73a16754f1adb1cfab5ae21f0c70e12fe1742bde553fb7662b5def819a8e132afb09a4b50c32a2094a2c64a2ecd99cbbe8d2da4fea704f39a94aae0afd8e8490189ce
X-VERSION: 1.5.0
Accept-Language: en-US,en;q=0.5
Content-Type: application/json
Content-Length: 396
[
    {
        "product_id": 574,
        "product_price_id": null,
        "product_option_id": null,
        "percentage": 21.85,
        "method": "takeout",
        "start_date": null
    },
    {
        "product_id": 574,
        "product_price_id": null,
        "product_option_id": null,
        "percentage": 33,
        "method": "delivery",
        "start_date": "2019-01-01"
    }
]

Example request 3 Create one VAT change for a product price

POST /company/companies/204/vat-changes HTTP/1.1
Host: api.bakeronline.be
Authorization: Bearer 9cb5e0ccf0325a257ff9811df033b489915b575961b3abbffb2d180ba2b19f9749a73a16754f1adb1cfab5ae21f0c70e12fe1742bde553fb7662b5def819a8e132afb09a4b50c32a2094a2c64a2ecd99cbbe8d2da4fea704f39a94aae0afd8e8490189ce
X-VERSION: 1.5.0
Accept-Language: en-US,en;q=0.5
Content-Type: application/json
Content-Length: 196
[
    {
        "product_id": null,
        "product_price_id": 348,
        "product_option_id": null,
        "percentage": 21.85,
        "method": "takeout",
        "start_date": null
    }
]

Example request 4 Create one VAT change for a product option

POST /company/companies/204/vat-changes HTTP/1.1
Host: api.bakeronline.be
Authorization: Bearer 9cb5e0ccf0325a257ff9811df033b489915b575961b3abbffb2d180ba2b19f9749a73a16754f1adb1cfab5ae21f0c70e12fe1742bde553fb7662b5def819a8e132afb09a4b50c32a2094a2c64a2ecd99cbbe8d2da4fea704f39a94aae0afd8e8490189ce
X-VERSION: 1.5.0
Accept-Language: en-US,en;q=0.5
Content-Type: application/json
Content-Length: 197
[
    {
        "product_id": null,
        "product_price_id": null,
        "product_option_id": 1974,
        "percentage": 21.85,
        "method": "takeout",
        "start_date": null
    }
]

Example request 5 Invalid product id

POST /company/companies/204/vat-changes HTTP/1.1
Host: api.bakeronline.be
Authorization: Bearer 9cb5e0ccf0325a257ff9811df033b489915b575961b3abbffb2d180ba2b19f9749a73a16754f1adb1cfab5ae21f0c70e12fe1742bde553fb7662b5def819a8e132afb09a4b50c32a2094a2c64a2ecd99cbbe8d2da4fea704f39a94aae0afd8e8490189ce
X-VERSION: 1.5.0
Accept-Language: en-US,en;q=0.5
Content-Type: application/json
Content-Length: 206
[
    {
        "product_id": 9265323235642,
        "product_price_id": null,
        "product_option_id": null,
        "percentage": 21.85,
        "method": "takeout",
        "start_date": null
    }
]

Example request 6 Invalid product price id

POST /company/companies/204/vat-changes HTTP/1.1
Host: api.bakeronline.be
Authorization: Bearer 9cb5e0ccf0325a257ff9811df033b489915b575961b3abbffb2d180ba2b19f9749a73a16754f1adb1cfab5ae21f0c70e12fe1742bde553fb7662b5def819a8e132afb09a4b50c32a2094a2c64a2ecd99cbbe8d2da4fea704f39a94aae0afd8e8490189ce
X-VERSION: 1.5.0
Accept-Language: en-US,en;q=0.5
Content-Type: application/json
Content-Length: 206
[
    {
        "product_id": null,
        "product_price_id": 9265323235642,
        "product_option_id": null,
        "percentage": 21.85,
        "method": "takeout",
        "start_date": null
    }
]

Example request 7 Invalid product option id

POST /company/companies/204/vat-changes HTTP/1.1
Host: api.bakeronline.be
Authorization: Bearer 9cb5e0ccf0325a257ff9811df033b489915b575961b3abbffb2d180ba2b19f9749a73a16754f1adb1cfab5ae21f0c70e12fe1742bde553fb7662b5def819a8e132afb09a4b50c32a2094a2c64a2ecd99cbbe8d2da4fea704f39a94aae0afd8e8490189ce
X-VERSION: 1.5.0
Accept-Language: en-US,en;q=0.5
Content-Type: application/json
Content-Length: 206
[
    {
        "product_id": null,
        "product_price_id": null,
        "product_option_id": 9265323235642,
        "percentage": 21.85,
        "method": "takeout",
        "start_date": null
    }
]

Example request 8 No ids given

POST /company/companies/204/vat-changes HTTP/1.1
Host: api.bakeronline.be
Authorization: Bearer 9cb5e0ccf0325a257ff9811df033b489915b575961b3abbffb2d180ba2b19f9749a73a16754f1adb1cfab5ae21f0c70e12fe1742bde553fb7662b5def819a8e132afb09a4b50c32a2094a2c64a2ecd99cbbe8d2da4fea704f39a94aae0afd8e8490189ce
X-VERSION: 1.5.0
Accept-Language: en-US,en;q=0.5
Content-Type: application/json
Content-Length: 197
[
    {
        "product_id": null,
        "product_price_id": null,
        "product_option_id": null,
        "percentage": 21.85,
        "method": "takeout",
        "start_date": null
    }
]

Example request 9 Multiple invalid ones return multiple errors in the same order

POST /company/companies/204/vat-changes HTTP/1.1
Host: api.bakeronline.be
Authorization: Bearer 9cb5e0ccf0325a257ff9811df033b489915b575961b3abbffb2d180ba2b19f9749a73a16754f1adb1cfab5ae21f0c70e12fe1742bde553fb7662b5def819a8e132afb09a4b50c32a2094a2c64a2ecd99cbbe8d2da4fea704f39a94aae0afd8e8490189ce
X-VERSION: 1.5.0
Accept-Language: en-US,en;q=0.5
Content-Type: application/json
Content-Length: 410
[
    {
        "product_id": 9265323235642,
        "product_price_id": null,
        "product_option_id": null,
        "percentage": 21.85,
        "method": "takeout",
        "start_date": null
    },
    {
        "product_id": null,
        "product_price_id": 9265323235642,
        "product_option_id": null,
        "percentage": 21.85,
        "method": "takeout",
        "start_date": null
    }
]

Example request 10 Product, product price and product option should belong to the company in the parameters

POST /company/companies/204/vat-changes HTTP/1.1
Host: api.bakeronline.be
Authorization: Bearer 9cb5e0ccf0325a257ff9811df033b489915b575961b3abbffb2d180ba2b19f9749a73a16754f1adb1cfab5ae21f0c70e12fe1742bde553fb7662b5def819a8e132afb09a4b50c32a2094a2c64a2ecd99cbbe8d2da4fea704f39a94aae0afd8e8490189ce
X-VERSION: 1.5.0
Accept-Language: en-US,en;q=0.5
Content-Type: application/json
Content-Length: 585
[
    {
        "product_id": 576,
        "product_price_id": null,
        "product_option_id": null,
        "percentage": 21.85,
        "method": "takeout",
        "start_date": null
    },
    {
        "product_id": null,
        "product_price_id": 350,
        "product_option_id": null,
        "percentage": 21.85,
        "method": "takeout",
        "start_date": null
    },
    {
        "product_id": null,
        "product_price_id": null,
        "product_option_id": 2011,
        "percentage": 21.85,
        "method": "takeout",
        "start_date": null
    }
]

Response

Array of company.VATChange: [company.VATChange]

company.VATChange

Field Type Description
product_id Int? Nullable. The ID of the product where this VAT percentage is applied.
product_price_id Int? Nullable. The ID of the product price where this VAT percentage is applied.
product_option_id Int? Nullable. The ID of the product option where this VAT percentage is applied.
percentage Float The VAT percentage
method String The take out method for which this VAT percentage should get applied
start_date Date? Nullable. When this VAT percentage will take effect. Use null to apply since the beginning.
id Int The unique ID of this VAT change

Example response 1 Create one VAT change for a product

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

[
    {
        "id": 152,
        "product_id": 574,
        "product_price_id": null,
        "product_option_id": null,
        "percentage": 21.85,
        "method": "takeout",
        "start_date": null
    }
]

Example response 2 Create multiple VAT changes for a product

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

[
    {
        "id": 153,
        "product_id": 574,
        "product_price_id": null,
        "product_option_id": null,
        "percentage": 21.85,
        "method": "takeout",
        "start_date": null
    },
    {
        "id": 154,
        "product_id": 574,
        "product_price_id": null,
        "product_option_id": null,
        "percentage": 33,
        "method": "delivery",
        "start_date": "2019-01-01"
    }
]

Example response 3 Create one VAT change for a product price

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

[
    {
        "id": 155,
        "product_id": null,
        "product_price_id": 348,
        "product_option_id": null,
        "percentage": 21.85,
        "method": "takeout",
        "start_date": null
    }
]

Example response 4 Create one VAT change for a product option

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

[
    {
        "id": 156,
        "product_id": null,
        "product_price_id": null,
        "product_option_id": 1974,
        "percentage": 21.85,
        "method": "takeout",
        "start_date": null
    }
]

Example response 5 Invalid product id

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

[
    {
        "code": "invalid_field",
        "message": "Invalid product with id 9265323235642",
        "field": "0.product_id"
    }
]

Example response 6 Invalid product price id

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

[
    {
        "code": "invalid_field",
        "message": "Invalid product price with id 9265323235642",
        "field": "0.product_price_id"
    }
]

Example response 7 Invalid product option id

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

[
    {
        "code": "invalid_field",
        "message": "Invalid product option with id 9265323235642",
        "field": "0.product_option_id"
    }
]

Example response 8 No ids given

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

[
    {
        "code": "missing_field",
        "message": "Please provide an id for a product, product price or a product option.",
        "field": "0"
    }
]

Example response 9 Multiple invalid ones return multiple errors in the same order

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

[
    {
        "code": "invalid_field",
        "message": "Invalid product with id 9265323235642",
        "field": "0.product_id"
    },
    {
        "code": "invalid_field",
        "message": "Invalid product price with id 9265323235642",
        "field": "1.product_price_id"
    }
]

Example response 10 Product, product price and product option should belong to the company in the parameters

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

[
    {
        "code": "invalid_field",
        "message": "Product with id 576 does not belong to company with id 204",
        "field": "0.product_id"
    },
    {
        "code": "invalid_field",
        "message": "Product price with id 350 does not belong to company with id 204",
        "field": "1.product_price_id"
    },
    {
        "code": "invalid_field",
        "message": "Product option with id 2011 does not belong to company with id 204",
        "field": "2.product_option_id"
    }
]
1.5.0 stable