Product Groups (Productgroepen) =============================== Current version: 1.0.0 Create ------ .. http:post:: /api2/productgroepen Create a new product group **Example request**: .. sourcecode:: http POST /api2/productgroepen HTTP/1.1 Host: demo.recras.nl Accept: application/json { "naam": "Sport", "slug": "sport", "ledger_number": "1001" } **Example response**: .. sourcecode:: http HTTP/1.1 201 Created Content-Type: application/json Location: /api2/productgroepen/5 { "id": 2, "naam": "Sport", "slug": "sport", "ledger_number": "1001" } :json string naam: **Required** Name of the product group (`naam` means name) :json string slug: Unique name for use in tag, allowed characters are: lowercase letters, numbers, ``-`` (hyphen) and ``_`` (underscore) (`koppelteken` means hyphen, `laag streepje` means underscore) :json string ledger_number: Ledger number (`Grootboeknummer`) to use with this product group. May contain letters and numbers. :resheader Location: The location of the new product group :statuscode 201: Product group created (`Productgroep gemaakt`) :statuscode 406: Error in input (`Fout in de invoer`) :statuscode 403: User does not have the ``editProducten`` (editProducts) permission (`Gebruiker heeft het recht editProducten niet`) Read ---- These endpoints are publicly accessible and do not require authentication. .. http:get:: /api2/productgroepen The product groups in Recras **Example request**: .. sourcecode:: http GET /api2/productgroepen HTTP/1.1 Host: demo.recras.nl Accept: application/json **Example response**: .. sourcecode:: http HTTP/1.1 200 OK Content-Type: application/json [ { "id": 1, "naam": "Eten", // (name: "Food") "slug": "eten", // (food) "ledger_number": "1004" } ] :statuscode 200: no error .. http:get:: /api2/productgroepen/(int:id) A specific product group **Example request**: .. sourcecode:: http GET /api2/productgroepen/1 HTTP/1.1 Host: demo.recras.nl Accept: application/json **Example response**: .. sourcecode:: http HTTP/1.1 200 OK Content-Type: application/json { "id": 1, "naam": "Eten", // (name: "Food") "slug": "eten", // (food) "ledger_number": "1004" } :statuscode 200: OK :statuscode 404: No product group with this ``id`` (`Geen productgroep met deze id`) Update ------ .. http:put:: /api2/productgroepen/(int:id) **Example request**: .. sourcecode:: http PUT /api2/productgroepen/2 HTTP/1.1 Host: demo.recras.nl Accept: application/json { "id": 2 "naam": "Sporten", } **Example response**: .. sourcecode:: http HTTP/1.1 200 OK Content-Type: application/json { "id": 2, "naam": "Sporten", "slug": "sport", "ledger_number": "1001" } :json int id: ID-nummer, mag niet veranderd worden :json string naam: Name of the product group (`naam` means name) :json string slug: Unique name for use in tag, allowed characters are: lowercase letters, numbers, ``-`` (hyphen) and ``_`` (underscore) (`koppelteken` means hyphen, `laag streepje` means underscore) :json string ledger_number: Ledger number (`Grootboeknummer`) to use with this product group. May contain letters and numbers. :statuscode 200: Product group updated (`Productgroep aangepast`) :statuscode 406: Error in input (`Fout in de invoer`) :statuscode 403: User does not have the ``editProducten`` (editProducts) permission (`Gebruiker heeft het recht editProducten niet`) Delete ------ .. http:delete:: /api2/productgroepen/(int:id) **Example request**: .. sourcecode:: http DELETE /api2/productgroepen/2 HTTP/1.1 Host: demo.recras.nl **Example response**: .. sourcecode:: http HTTP/1.1 200 OK :statuscode 200: Product group deleted (`Productgroep verwijderd`) :statuscode 403: User does not have the ``editProducten`` (editProducts) permission (`Gebruiker heeft het recht editProducten niet`)