Contacten ========= Huidige versie: 0.2.0 Read ---- .. http:get:: /api2/contacten Lijst van contacten in Recras. Dit geeft contacten van alle types weer. **Voorbeeld request**: .. sourcecode:: http GET /api2/contacten HTTP/1.1 Host: demo.recras.nl Accept: application/json **Voorbeeld response**: .. sourcecode:: http HTTP/1.1 200 OK Content-Type: application/json [ { "id": 47, "type": "leverancier", "displaynaam": "Accommodatie Recras", "naam": "Accommodatie Recras", "adres": "", "postcode": "", "plaats": "Lheebroek", "landcode": "NL", "provinciecode": "NL-DR", "website": "", "btw_nummer": null, "bedrijf_id": 1, "status": "actief", "veelgebruikt": false, "betalen_vanaf": null, "uitje_activiteit_herinnering": false, "onchange_email": false, "_links": { "curies": [ { "name": "recras", "href": "/api_docs/{rel}.html", "templated": true } ], "self": { "href": "/api2.php/leveranciers/47" } }, "mag_type_wijzigen": false, "contactpersonen": [ { "id": 48, "voornaam": "Marthijn", "achternaam": "Wolting", "geslacht": "onbekend", "aanhef": "", "adres": "", "postcode": "", "plaats": "", "telefoon1": "", "telefoon2": "", "email1": "", "email2": "", "hoofdcontact": true, "nieuwsbrief_ids": [ ] } ] }, { "id": 42, "type": "klant", "displaynaam": "Activiteitenclub", "naam": "Activiteitenclub", "adres": "", "postcode": "", "plaats": "Driesbergen", "landcode": "NL", "provinciecode": "NL-UT", "website": null, "btw_nummer": null, "bedrijf_id": 1, "soort_klant": "", "afdeling": "", "factuur_adressering": "", "_links": { "curies": [ { "name": "recras", "href": "/api_docs/{rel}.html", "templated": true } ], "self": { "href": "/api2.php/klanten/42" } }, "mag_type_wijzigen": false, "contactpersonen": [ { "id": 36, "voornaam": "Cees", "achternaam": "Verkade", "geslacht": "man", "aanhef": "", "adres": "", "postcode": "", "plaats": "", "telefoon1": "", "telefoon2": "", "email1": "", "email2": "", "hoofdcontact": true, "nieuwsbrief_ids": [ ] } ] } ] :statuscode 200: OK .. http:get:: /api2/contacten/(int:id) Een specifiek contact. In het geval dat het contact van het type ``leverancier`` of ``klant`` is, zal naar het specifiekere endpoint verwezen worden. **Voorbeeld request**: .. sourcecode:: http GET /api2/contacten/47 HTTP/1.1 Host: demo.recras.nl Accept: application/json **Voorbeeld response**: .. sourcecode:: http HTTP/1.1 200 OK Content-Type: application/json { "id": 47, "type": "leverancier", "displaynaam": "Accommodatie Recras", "naam": "Accommodatie Recras", "adres": "", "postcode": "", "plaats": "Lheebroek", "landcode": "NL", "provinciecode": "NL-DR", "website": "", "btw_nummer": null, "bedrijf_id": 1, "status": "actief", "veelgebruikt": false, "betalen_vanaf": null, "uitje_activiteit_herinnering": false, "onchange_email": false, "_links": { "curies": [ { "name": "recras", "href": "/api_docs/{rel}.html", "templated": true } ], "self": { "href": "/api2.php/leveranciers/47" } }, "mag_type_wijzigen": false, "contactpersonen": [ { "id": 48, "voornaam": "Marthijn", "achternaam": "Wolting", "geslacht": "onbekend", "aanhef": "", "adres": "", "postcode": "", "plaats": "", "telefoon1": "", "telefoon2": "", "email1": "", "email2": "", "hoofdcontact": true, "nieuwsbrief_ids": [ ] } ] } :statuscode 200: OK :statuscode 301: Volg de http-referer in de 'Location' header voor het contact. :statuscode 404: Geen contact met dit ``id`` Create ------ .. http:post:: /api2/contacten Create a relation **Example request**: .. sourcecode:: http POST /api2/contacten HTTP/1.1 Host: demo.recras.nl Accept: application/json { "naam": "Voorbeeldgroep", "type": "klant", "adres": "Teststraat 1", "postcode": "1337 XD", "plaats": "Teststad", "landcode": "NL", "provinciecode": "NL-NH", "website": "https://www.recras.nl/", "btw_nummer": null, "bedrijf_id": 1, "status": "actief", "mag_type_wijzigen": false, "contactpersonen": [ { "id": 15, "hoofdcontact": false }, { "voornaam": "Test", "achternaam": "Contactpersoon", "geslacht": "man", "aanhef": null, "adres": "Teststraat 1", "postcode": "1337 XD", "plaats": "Teststad", "telefoon1": "0123456789", "email1": "test@example.com", "hoofdcontact": true } ], "extra_fields": [ { "name": "Shoe size", "type": "number", "value": 42, } ] } :json string displaynaam: The display name of the relation :json string naam: The internal name of the relation :json string type: The type of relation. Will default to ``overig`` (Other contact) if empty. Allowed values are: ``klant`` (Customer), ``leverancier`` (Supplier), ``personeel`` (Staff) and ``overig`` (Other contact) :json string adres: The address of the relation :json string postcode: The postcode of the relation :json string plaats: The city of the relation :json string landcode: An [ISO 3166-1](https://en.wikipedia.org/wiki/ISO_3166-1) country code :json string provinciecode: An [ISO 3166-2](https://en.wikipedia.org/wiki/ISO_3166-2) subdivision code :json string website: The website of the relation :json int bedrijf_id: ``id`` of a company this relation belongs to. The default company will be entered if this field is left empty. :json string btw_nummer: VAT number of the relation :json string status: Is the relation active (``actief``) or not (``passief``). Only valid for type ``leverancier`` :json bool mag_type_wijzigen: Can this relation change type or not :json array contactpersonen: **Required** List of one or more contact persons to associate with this relation. These can either exist in Recras already, or be new entries. :json boolean contactpersonen.hoofdcontact: **Required** for each contact person it must be noted whether this contact person is the main contact person of this relation. There can only be 1 main contact person per relation. :json array extra_fields: Array of extra fields. ``type`` can be one of the following: ``text``, ``number``, ``date``, ``singlechoice``, ``multiplechoice``. When ``type`` is ``number``, ``value`` is of type ``integer``. When ``type`` is ``date``, ``value`` is an ISO 8601 formatted date. When ``type`` is ``multiplechoice``, ``value`` is an array of string values. When an existing contact person is linked: :json int contactpersonen.id: ``id`` of the contact persoon When a new contact person is entered (see also ``/contactpersonen``) :json string voornaam: Given name of the contact person :json string achternaam: Family name of the contact person :json string geslacht: Gender of the contact person. Valid values are 'man' (male), 'vrouw' (female), 'onbekend' (unknown) :json string aanhef: Salutation to use :json string adres: Address :json string postcode: Postcode :json string plaats: City :json string telefoon1: Telephone 1 :json string telefoon2: Telephone 2 :json string email1: Email address 1 :json string email2: Email address 2 :statuscode 201: Relation created :statuscode 200: Entered data is merged with an existing relation :statuscode 406: Error in the input :statuscode 403: User does not have the permission ``editContact`` Update ------ .. http:put:: /api2/contacten/(int:id) Update a relation Body contains the same field as for the Create action Changelog ---------