Discount Codes (Kortingscodes)¶
Current version: 1.0.0
Create¶
- POST /api2/kortingscodes¶
Create a new discount code
Example request:
POST /api2/kortingscodes HTTP/1.1 Host: demo.recras.nl Accept: application/json { "naam": "Summer Sale", "code": "SUMMER2026", "datum_begin": "2026-06-01", "datum_eind": "2026-08-31", "kortingspercentage": 15, "toepasbaar_zonder_arrangement": false, "valid_days": {"1": true, "2": true, "3": true, "4": true, "5": true, "6": true, "7": true}, "Arrangementen": [1, 2], "BookProcesses": [3], "Products": [] }
Example response:
HTTP/1.1 201 Created Content-Type: application/json Location: /api2/kortingscodes/5 { "id": 5, "naam": "Summer Sale", "code": "SUMMER2026", "datum_begin": "2026-06-01", "datum_eind": "2026-08-31", "kortingspercentage": 15, "toepasbaar_zonder_arrangement": false, "valid_days": {"1": true, "2": true, "3": true, "4": true, "5": true, "6": true, "7": true}, "Arrangementen": [1, 2], "BookProcesses": [3], "Products": [], "created_at": "2026-06-01 10:00:00", "updated_at": "2026-06-01 10:00:00" }
- JSON Parameters:
naam (string) – Required Name of the discount code (naam means name)
code (string) – Required Unique discount code. Must be unique across both discount codes and vouchers.
datum_begin (string) – Required Start date in ISO 8601 format (YYYY-MM-DD) (datum_begin means start_date)
datum_eind (string) – Required End date in ISO 8601 format (YYYY-MM-DD), must be on or after
datum_begin(datum_eind means end_date)kortingspercentage (int) – Required Discount percentage, 0-100 (kortingspercentage means discount_percentage)
toepasbaar_zonder_arrangement (boolean) – Deprecated — will be removed in a future version. Whether the discount code can be applied without a package (toepasbaar_zonder_arrangement means applicable_without_package)
valid_days (object) – Weekdays when the discount is valid. Object with day numbers 1 (Monday) through 7 (Sunday) as keys, mapping to booleans.
Arrangementen (array) – List of package IDs this discount code applies to. Use
[]to clear.BookProcesses (array) – List of book process IDs this discount code applies to. Use
[]to clear.Products (array) – List of product IDs this discount code applies to. Use
[]to clear.
- Response Headers:
Location – The location of the new discount code
- Status Codes:
201 Created – Discount code created
406 Not Acceptable – Error in the input
409 Conflict – A discount code or voucher with this
codealready exists403 Forbidden – User does not have the
beheerKortingscodes(manageDiscountCodes) permission
Read¶
- GET /api2/kortingscodes¶
List all discount codes
Example request:
GET /api2/kortingscodes HTTP/1.1 Host: demo.recras.nl Accept: application/json
Example response:
HTTP/1.1 200 OK Content-Type: application/json [ { "id": 5, "naam": "Summer Sale", "code": "SUMMER2026", "datum_begin": "2026-06-01", "datum_eind": "2026-08-31", "kortingspercentage": 15, "toepasbaar_zonder_arrangement": false, "valid_days": {"1": true, "2": true, "3": true, "4": true, "5": true, "6": true, "7": true}, "Arrangementen": [1, 2], "BookProcesses": [3], "Products": [], "created_at": "2026-06-01 10:00:00", "updated_at": "2026-06-01 10:00:00" } ]
- Request Headers:
Authorization – mandatory Basic authentication
- Status Codes:
200 OK – no error
- GET /api2/kortingscodes/(int: id)¶
A specific discount code
Example request:
GET /api2/kortingscodes/5 HTTP/1.1 Host: demo.recras.nl Accept: application/json
Example response:
HTTP/1.1 200 OK Content-Type: application/json { "id": 5, "naam": "Summer Sale", "code": "SUMMER2026", "datum_begin": "2026-06-01", "datum_eind": "2026-08-31", "kortingspercentage": 15, "toepasbaar_zonder_arrangement": false, "valid_days": {"1": true, "2": true, "3": true, "4": true, "5": true, "6": true, "7": true}, "Arrangementen": [1, 2], "BookProcesses": [3], "Products": [], "created_at": "2026-06-01 10:00:00", "updated_at": "2026-06-01 10:00:00" }
- Request Headers:
Authorization – mandatory Basic authentication
- Status Codes:
200 OK – OK
404 Not Found – No discount code with this
id
Update¶
- PUT /api2/kortingscodes/(int: id)¶
Example request:
PUT /api2/kortingscodes/5 HTTP/1.1 Host: demo.recras.nl Accept: application/json { "id": 5, "naam": "Summer Sale Extended", "code": "SUMMER2026", "datum_begin": "2026-06-01", "datum_eind": "2026-09-30", "kortingspercentage": 20, "toepasbaar_zonder_arrangement": false, "valid_days": {"1": true, "2": true, "3": true, "4": true, "5": true, "6": false, "7": false}, "Arrangementen": [1, 2, 3], "BookProcesses": [], "Products": [] }
Example response:
HTTP/1.1 200 OK Content-Type: application/json { "id": 5, "naam": "Summer Sale Extended", "code": "SUMMER2026", "datum_begin": "2026-06-01", "datum_eind": "2026-09-30", "kortingspercentage": 20, "toepasbaar_zonder_arrangement": false, "valid_days": {"1": true, "2": true, "3": true, "4": true, "5": true, "6": false, "7": false}, "Arrangementen": [1, 2, 3], "BookProcesses": [], "Products": [], "created_at": "2026-06-01 10:00:00", "updated_at": "2026-06-15 14:30:00" }
- JSON Parameters:
id (int) – ID number, may not be changed
naam (string) – Required Name of the discount code (naam means name)
code (string) – Required Unique discount code. Must be unique across both discount codes and vouchers.
datum_begin (string) – Required Start date in ISO 8601 format (YYYY-MM-DD) (datum_begin means start_date)
datum_eind (string) – Required End date in ISO 8601 format (YYYY-MM-DD), must be on or after
datum_begin(datum_eind means end_date)kortingspercentage (int) – Required Discount percentage, 0-100 (kortingspercentage means discount_percentage)
toepasbaar_zonder_arrangement (boolean) – Deprecated — will be removed in a future version. Whether the discount code can be applied without a package (toepasbaar_zonder_arrangement means applicable_without_package)
valid_days (object) – Weekdays when the discount is valid. Object with day numbers 1 (Monday) through 7 (Sunday) as keys, mapping to booleans.
Arrangementen (array) – List of package IDs this discount code applies to. Use
[]to clear.BookProcesses (array) – List of book process IDs this discount code applies to. Use
[]to clear.Products (array) – List of product IDs this discount code applies to. Use
[]to clear.
- Status Codes:
200 OK – Discount code updated
406 Not Acceptable – Error in the input
409 Conflict – A discount code or voucher with this
codealready exists403 Forbidden – User does not have the
beheerKortingscodes(manageDiscountCodes) permission
Delete¶
- DELETE /api2/kortingscodes/(int: id)¶
Example request:
DELETE /api2/kortingscodes/5 HTTP/1.1 Host: demo.recras.nl
Example response:
HTTP/1.1 200 OK
- Status Codes:
200 OK – Discount code deleted
403 Forbidden – User does not have the
beheerKortingscodes(manageDiscountCodes) permission