Products (Producten)

Current version: 1.0.0

Create

POST /api2/producten

Create a new product

Example request:

POST /api2/producten HTTP/1.1
Host: demo.recras.nl
Accept: application/json

{
      "aantal": 1,
      "aantalbepaling": "per_x_personen", // (quantity_determination)
      "beschrijving_klant": "Lekker een uur klimmen in ons prachtige klimbos", // (description_customer: "Enjoy an hour of climbing in our beautiful climbing forest")
      "btw": 21, // (vat)
      "duur": "PT1H", // (duration)
      "extra": {
            "tag": "klimmen" // (climbing)
      }
      "inkoop": 0, // (purchase_price)
      "leverancier_id": 3, // (supplier_id)
      "locatie_verplicht": true, // (location_required)
      "Locaties": [ // (Locations)
            {
                  "id": 27,
                  "naam": "Klimbos", // (name: "Climbing Forest")
                  "kleur": "#40ed21", // (color)
                  "weergavenaam": "Klimbos", // (display_name: "Climbing Forest")
                  "adres": "Steenhopenweg 4", // (address)
                  "postcode": "9533PN", // (postal_code)
                  "plaats": "Drouwen", // (city)
                  "telefoonnummer": "", // (phone_number)
                  "latitude": 52.95123,
                  "longitude": 6.746721,
                  "capaciteit": null, // (capacity)
                  "aantal_groepen": null, // (number_of_groups)
                  "uitgebreide_omschrijving": "", // (extended_description)
                  "image_filename": "",
                  "parent_id": 28
            },
            {
                  "id": 28,
            }
      ],
      "Materialen": [ // (Materials)
         {
            "materiaal_id": 3, // (material_id)
            "aantal": 1, // (quantity)
            "per_x_aantal": 1, // (per_x_quantity)
            "afronding": "boven" // (rounding: "up")
         }
      ],
      "los_op_planning": true, // (separate_on_planning)
      "minimum_aantal": 1, // (minimum_quantity)
      "naam": "Klimmen 1u kind", // (name: "Climbing 1hr child")
      "per_x_personen": 1, // (per_x_persons)
      "per_x_personen_afronding": "boven", // (per_x_persons_rounding: "up")
      "personeelsinstructie": "Let goed op de jongste kinderen", // (staff_instruction: "Pay close attention to the youngest children")
      "planstrategie": null, // (planning_strategy)
      "productgroep_id": 1, // (product_group_id)
      "Standaardbijlagen": [], // (DefaultAttachments)
      "uitgebreide_omschrijving": "Nadat je instructies hebt gekregen kun je lekker een uur vrij klimmen in ons klimbos.", // (extended_description: "After receiving instructions, you can enjoy an hour of free climbing in our climbing forest.")
      "verkoop": 15, // (sales_price)
      "weergavenaam": "1 uur klimmen voor kinderen", // (display_name: "1 hour climbing for children")
      "ProductPrice": [
         {
            "btw": 21, // (vat)
            "verkoop": 15, // (sales_price)
         }
      ]
}

Example response:

HTTP/1.1 201 Created
Content-Type: application/json
Location: /api2/producten/5

{
    "aantal": 1,
    "aantalbepaling": "per_x_personen", // (quantity_determination)
    "beschrijving_klant": "Lekker een uur klimmen in ons prachtige klimbos", // (description_customer: "Enjoy an hour of climbing in our beautiful climbing forest")
    "btw": 21, // (vat)
    "duur": "PT1H", // (duration)
    "extra": {
        "tag": "klimmen" // (climbing)
    }
    "inkoop": 0, // (purchase_price)
    "leverancier_id": 3, // (supplier_id)
    "locatie_verplicht": true, // (location_required)
    "Locaties": [ // (Locations)
        {
            "id": 27,
            "naam": "Klimbos", // (name: "Climbing Forest")
            "kleur": "#40ed21", // (color)
            "weergavenaam": "Klimbos", // (display_name: "Climbing Forest")
            "adres": "Steenhopenweg 4", // (address)
            "postcode": "9533PN", // (postal_code)
            "plaats": "Drouwen", // (city)
            "telefoonnummer": "", // (phone_number)
            "latitude": 52.95123,
            "longitude": 6.746721,
            "capaciteit": null, // (capacity)
            "aantal_groepen": null, // (number_of_groups)
            "uitgebreide_omschrijving": "", // (extended_description)
            "image_filename": "",
            "parent_id": 28
        },
        {
            "id": 28,
        }
    ],
    "los_op_planning": true, // (separate_on_planning)
    "minimum_aantal": 1, // (minimum_quantity)
    "naam": "Klimmen 1u kind", // (name: "Climbing 1hr child")
    "per_x_personen": 1, // (per_x_persons)
    "per_x_personen_afronding": "boven", // (per_x_persons_rounding: "up")
    "personeelsinstructie": "Let goed op de jongste kinderen", // (staff_instruction: "Pay close attention to the youngest children")
    "planstrategie": null, // (planning_strategy)
    "productgroep_id": 1, // (product_group_id)
    "Standaardbijlagen": [], // (DefaultAttachments)
    "uitgebreide_omschrijving": "Nadat je instructies hebt gekregen kun je lekker een uur vrij klimmen in ons klimbos.", // (extended_description: "After receiving instructions, you can enjoy an hour of free climbing in our climbing forest.")
    "verkoop": 15, // (sales_price)
    "ProductPrice": [
      {
         "btw": 21, // (vat)
         "verkoop": 15, // (sales_price)
      }
    ],
    "weergavenaam": "1 uur klimmen voor kinderen", // (display_name: "1 hour climbing for children")
}
JSON Parameters:
  • duur (string) – An ISO8601 duration (duur means duration)

  • extra (object) – A key-value object with extra fields

  • Locaties (array) – An array of all locations (Locaties) where this product may take place. Only the id field herein is required.

  • inkoop (float) – Required the purchase price (inkoop) of the product. May be 0.

  • verkoop (float) – Deprecated the sales price (verkoop) of the product (use ProductPrice instead)

  • leverancier_id (int) – Required the id of the supplier (leverancier_id)

  • minimum_aantal (int) – Required the minimum quantity (minimum_aantal) that must be purchased of this product

  • naam (string) – Required The internal name (naam) of the product

  • weergavenaam (string) – The name of the product as shown to customers (weergavenaam means display_name)

  • Materialen (array) – A list of material usage objects. Example: tandem bikes: use {"id": 2, "aantal": 1, "per_x_aantal": 2, "afronding": "boven"} to require 1 unit of material 2 per 2 units (rounded up) of this product booked. (Materialen means Materials, aantal means quantity, per_x_aantal means per_x_quantity, afronding means rounding, boven means up)

  • Materialen.materiaal_id (int) – Required A reference to a material id (materiaal_id means material_id)

  • Materialen.aantal (float) – Required The amount (aantal) of material that this product uses

  • Materialen.per_x_aantal (int) – Required With which amount (aantal) of this product the material use increases (per_x_aantal means per_x_quantity)

  • Materialen.afronding (string) – Required Rounding (afronding) of the number of products. Possible values are boven (for rounding up to the nearest multiple of per_x_aantal) and niet (for no rounding)

  • ProductPrice (array) – A list of prices for this product, allows to use multiple vat tariffs. Example: "ProductPrice": [{"btw": 21,"verkoop": 15,}] (btw means vat, verkoop means sales_price)

Response Headers:
  • Location – The location of the new product

Status Codes:
  • 201 Created – Product created (Product gemaakt)

  • 406 Not Acceptable – Error in input (Fout in de invoer)

  • 403 Forbidden – User does not have the editProducten (editProducts) permission (Gebruiker heeft het recht editProducten niet)

Read

GET /api2/producten

The products in Recras

Example request:

GET /api2/producten HTTP/1.1
Host: demo.recras.nl
Accept: application/json

Example response:

HTTP/1.1 200 OK
Content-Type: application/json

[
   {
      "id": 6,
      "leverancier_id": 2, // (supplier_id)
      "naam": "Groepen klimmen", // (name: "Group climbing")
      "weergavenaam": "", // (display_name)
      "inkoop": 7, // (purchase_price)
      "verkoop": 15, // (sales_price)
      "minimum_aantal": 8, // (minimum_quantity)
      "duur": "PT2H30M00S", // (duration)
      "btw": 6, // (vat)
      "beschrijving_klant": "Met de hele groep, onder begeleiding, heerlijk klimmen.", // (description_customer: "With the whole group, under supervision, enjoy climbing.")
      "uitgebreide_omschrijving": "<p>Waan jezelf Tarzan, Jane in ons 20 hectare grote klimbos. In het klimbos zijn 12 verschillende routes met in totaal 124 hindernissen, voor elk wat wils!</p> <p>&nbsp;</p> <p><strong>Instructie:</strong></p> <p>Na de uitgebreide instructie op het instructieparcours, door 1 van onze gediplomeerde instructeurs, is het tijd om zelf de bomen in te gaan. Tijdens de eerste routes zullen de begeleiders u nog goed in de gaten houden, indien u heeft laten zien dat u het klimmen goed onder de knie heeft mag u zelfstandig de laatste parcoursen afleggen!</p>", // (extended_description: "<p>Imagine yourself Tarzan, Jane in our 20-hectare climbing forest. In the climbing forest there are 12 different routes with a total of 124 obstacles, something for everyone!</p> <p>&nbsp;</p> <p><strong>Instruction:</strong></p> <p>After the extensive instruction on the instruction course, by one of our certified instructors, it is time to go into the trees yourself. During the first routes, the supervisors will keep a close eye on you, if you have shown that you have mastered climbing well, you can complete the last courses independently!</p>")
      "productgroep_id": 3, // (product_group_id)
      "mag_api": true, // (may_use_api)
      "los_op_planning": true, // (separate_on_planning)
      "planstrategie": "drukte", // (planning_strategy: "busyness")
      "personeelsinstructie": "", // (staff_instruction)
      "locatie_verplicht": true, // (location_required)
      "extra": null,
      "aantalbepaling": "per_x_personen", // (quantity_determination)
      "aantal": 1, // (quantity)
      "per_x_personen": 1, // (per_x_persons)
      "per_x_personen_afronding": "boven", // (per_x_persons_rounding: "up")
      "is_deleted": false,
      "ProductPrice": [
         {
            "btw": 21, // (vat)
            "verkoop": 15, // (sales_price)
         }
      ],
      "afbeelding_href": "/api2/producten/6/afbeelding" // (image_href)
   }
]
Status Codes:
GET /api2/producten/(int: id)

A specific product

Example request:

GET /api2/producten/6 HTTP/1.1
Host: demo.recras.nl
Accept: application/json

Example response:

HTTP/1.1 200 OK
Content-Type: application/json

{
   "id": 6,
   "leverancier_id": 2, // (supplier_id)
   "naam": "Groepen klimmen", // (name: "Group climbing")
   "weergavenaam": "", // (display_name)
   "inkoop": 7, // (purchase_price)
   "verkoop": 15, // (sales_price)
   "minimum_aantal": 8, // (minimum_quantity)
   "duur": "PT2H30M00S", // (duration)
   "btw": 6, // (vat)
   "beschrijving_klant": "Met de hele groep, onder begeleiding, heerlijk klimmen.", // (description_customer: "With the whole group, under supervision, enjoy climbing.")
   "uitgebreide_omschrijving": "<p>Waan jezelf Tarzan, Jane in ons 20 hectare grote klimbos. In het klimbos zijn 12 verschillende routes met in totaal 124 hindernissen, voor elk wat wils!</p> <p>&nbsp;</p> <p><strong>Instructie:</strong></p> <p>Na de uitgebreide instructie op het instructieparcours, door 1 van onze gediplomeerde instructeurs, is het tijd om zelf de bomen in te gaan. Tijdens de eerste routes zullen de begeleiders u nog goed in de gaten houden, indien u heeft laten zien dat u het klimmen goed onder de knie heeft mag u zelfstandig de laatste parcoursen afleggen!</p>", // (extended_description: "<p>Imagine yourself Tarzan, Jane in our 20-hectare climbing forest. In the climbing forest there are 12 different routes with a total of 124 obstacles, something for everyone!</p> <p>&nbsp;</p> <p><strong>Instruction:</strong></p> <p>After the extensive instruction on the instruction course, by one of our certified instructors, it is time to go into the trees yourself. During the first routes, the supervisors will keep a close eye on you, if you have shown that you have mastered climbing well, you can complete the last courses independently!</p>")
   "productgroep_id": 3, // (product_group_id)
   "mag_api": true, // (may_use_api)
   "los_op_planning": true, // (separate_on_planning)
   "planstrategie": "drukte", // (planning_strategy: "busyness")
   "personeelsinstructie": "", // (staff_instruction)
   "locatie_verplicht": true, // (location_required)
   "extra": null,
   "aantalbepaling": "per_x_personen", // (quantity_determination)
   "aantal": 1, // (quantity)
   "per_x_personen": 1, // (per_x_persons)
   "per_x_personen_afronding": "boven", // (per_x_persons_rounding: "up")
   "is_deleted": false,
   "ProductPrice": [
      {
         "btw": 21, // (vat)
         "verkoop": 15, // (sales_price)
      }
   ],
   "afbeelding_href": "/api2/producten/6/afbeelding" // (image_href)
}
Status Codes:

Update

PUT /api2/producten/(int: id)

Example request:

PUT /api2/producten/6 HTTP/1.1
Host: demo.recras.nl
Accept: application/json

{
   "id": 6,
   "leverancier_id": 2,
   "naam": "Groepen klimmen",
   "weergavenaam": "",
   "inkoop": 7,
   "verkoop": 15,
   "ProductPrice": [
      {
         "btw": 21,
         "verkoop": 15,
      }
   ],
   "minimum_aantal": 8,
   "duur": "PT2H00M00S",
}

Example response:

HTTP/1.1 200 OK
Content-Type: application/json

{
   "id": 6,
   "leverancier_id": 2, // (supplier_id)
   "naam": "Groepen klimmen", // (name: "Group climbing")
   "weergavenaam": "", // (display_name)
   "inkoop": 7, // (purchase_price)
   "verkoop": 15, // (sales_price)
   "minimum_aantal": 8, // (minimum_quantity)
   "duur": "PT2H00M00S", // (duration)
   "btw": 6, // (vat)
   "beschrijving_klant": "Met de hele groep, onder begeleiding, heerlijk klimmen.", // (description_customer: "With the whole group, under supervision, enjoy climbing.")
   "uitgebreide_omschrijving": "<p>Waan jezelf Tarzan, Jane in ons 20 hectare grote klimbos. In het klimbos zijn 12 verschillende routes met in totaal 124 hindernissen, voor elk wat wils!</p> <p>&nbsp;</p> <p><strong>Instructie:</strong></p> <p>Na de uitgebreide instructie op het instructieparcours, door 1 van onze gediplomeerde instructeurs, is het tijd om zelf de bomen in te gaan. Tijdens de eerste routes zullen de begeleiders u nog goed in de gaten houden, indien u heeft laten zien dat u het klimmen goed onder de knie heeft mag u zelfstandig de laatste parcoursen afleggen!</p>", // (extended_description: "<p>Imagine yourself Tarzan, Jane in our 20-hectare climbing forest. In the climbing forest there are 12 different routes with a total of 124 obstacles, something for everyone!</p> <p>&nbsp;</p> <p><strong>Instruction:</strong></p> <p>After the extensive instruction on the instruction course, by one of our certified instructors, it is time to go into the trees yourself. During the first routes, the supervisors will keep a close eye on you, if you have shown that you have mastered climbing well, you can complete the last courses independently!</p>")
   "productgroep_id": 3, // (product_group_id)
   "mag_api": true, // (may_use_api)
   "los_op_planning": true, // (separate_on_planning)
   "planstrategie": "drukte", // (planning_strategy: "busyness")
   "personeelsinstructie": "", // (staff_instruction)
   "locatie_verplicht": true, // (location_required)
   "extra": null,
   "aantalbepaling": "per_x_personen", // (quantity_determination)
   "aantal": 1, // (quantity)
   "per_x_personen": 1, // (per_x_persons)
   "per_x_personen_afronding": "boven", // (per_x_persons_rounding: "up")
   "is_deleted": false,
   "ProductPrice": [
      {
         "btw": 21, // (vat)
         "verkoop": 15, // (sales_price)
      }
   ],
   "afbeelding_href": "/api2/producten/6/afbeelding" // (image_href)
}
JSON Parameters:
  • id (int) – ID number, may not be changed

Status Codes:
  • 200 OK – Product updated (Product aangepast)

  • 406 Not Acceptable – Error in input (Fout in de invoer)

  • 403 Forbidden – User does not have the editProducten (editProducts) permission (Gebruiker heeft het recht editProducten niet)

Delete

DELETE /api2/producten/(int: id)

Example request:

DELETE /api2/producten/6 HTTP/1.1
Host: demo.recras.nl

Example response:

HTTP/1.1 200 OK
Status Codes:
  • 200 OK – Product deleted (Product verwijderd)

  • 403 Forbidden – User does not have the editProducten (editProducts) permission (Gebruiker heeft het recht editProducten niet)