Contacts (Contacten) ==================== Current version: 0.2.0 Read ---- .. http:get:: /api2/contacten List of contacts in Recras. This displays contacts of all types. **Example request**: .. sourcecode:: http GET /api2/contacten HTTP/1.1 Host: demo.recras.nl Accept: application/json **Example response**: .. sourcecode:: http HTTP/1.1 200 OK Content-Type: application/json [ { "id": 47, "type": "leverancier", // (supplier) "displaynaam": "Accommodatie Recras", // (display_name: "Accommodation Recras") "naam": "Accommodatie Recras", // (name: "Accommodation Recras") "adres": "", // (address) "postcode": "", // (postal_code) "plaats": "Lheebroek", // (city) "landcode": "NL", // (country_code) "provinciecode": "NL-DR", // (province_code) "website": "", "btw_nummer": null, // (vat_number) "bedrijf_id": 1, // (company_id) "status": "actief", // (status: "active") "veelgebruikt": false, // (frequently_used) "betalen_vanaf": null, // (pay_from) "uitje_activiteit_herinnering": false, // (outing_activity_reminder) "onchange_email": false, "_links": { "curies": [ { "name": "recras", "href": "/api_docs/{rel}.html", "templated": true } ], "self": { "href": "/api2/leveranciers/47" // (suppliers) } }, "mag_type_wijzigen": false, // (may_change_type) "contactpersonen": [ // (contact_persons) { "id": 48, "voornaam": "Marthijn", // (first_name) "achternaam": "Wolting", // (last_name) "geslacht": "onbekend", // (gender: "unknown") "aanhef": "", // (salutation) "adres": "", // (address) "postcode": "", // (postal_code) "plaats": "", // (city) "telefoon1": "", // (phone1) "telefoon2": "", // (phone2) "email1": "", "email2": "", "hoofdcontact": true, // (main_contact) "nieuwsbrief_ids": [ ] // (newsletter_ids) } ] }, { "id": 42, "type": "klant", // (customer) "displaynaam": "Activiteitenclub", // (display_name: "Activity Club") "naam": "Activiteitenclub", // (name: "Activity Club") "adres": "", // (address) "postcode": "", // (postal_code) "plaats": "Driesbergen", // (city) "landcode": "NL", // (country_code) "provinciecode": "NL-UT", // (province_code) "website": null, "btw_nummer": null, // (vat_number) "bedrijf_id": 1, // (company_id) "soort_klant": "", // (customer_type) "afdeling": "", // (department) "factuur_adressering": "", // (invoice_addressing) "_links": { "curies": [ { "name": "recras", "href": "/api_docs/{rel}.html", "templated": true } ], "self": { "href": "/api2/klanten/42" // (customers) } }, "mag_type_wijzigen": false, // (may_change_type) "contactpersonen": [ // (contact_persons) { "id": 36, "voornaam": "Cees", // (first_name) "achternaam": "Verkade", // (last_name) "geslacht": "man", // (gender: "male") "aanhef": "", // (salutation) "adres": "", // (address) "postcode": "", // (postal_code) "plaats": "", // (city) "telefoon1": "", // (phone1) "telefoon2": "", // (phone2) "email1": "", "email2": "", "hoofdcontact": true, // (main_contact) "nieuwsbrief_ids": [ ] // (newsletter_ids) } ] } ] :statuscode 200: OK .. http:get:: /api2/contacten/(int:id) A specific contact. In case the contact is of type ``leverancier`` (supplier) or ``klant`` (customer), it will redirect to the more specific endpoint. **Example request**: .. sourcecode:: http GET /api2/contacten/47 HTTP/1.1 Host: demo.recras.nl Accept: application/json **Example response**: .. sourcecode:: http HTTP/1.1 200 OK Content-Type: application/json { "id": 47, "type": "leverancier", // (supplier) "displaynaam": "Accommodatie Recras", // (display_name: "Accommodation Recras") "naam": "Accommodatie Recras", // (name: "Accommodation Recras") "adres": "", // (address) "postcode": "", // (postal_code) "plaats": "Lheebroek", // (city) "landcode": "NL", // (country_code) "provinciecode": "NL-DR", // (province_code) "website": "", "btw_nummer": null, // (vat_number) "bedrijf_id": 1, // (company_id) "status": "actief", // (status: "active") "veelgebruikt": false, // (frequently_used) "betalen_vanaf": null, // (pay_from) "uitje_activiteit_herinnering": false, // (outing_activity_reminder) "onchange_email": false, "_links": { "curies": [ { "name": "recras", "href": "/api_docs/{rel}.html", "templated": true } ], "self": { "href": "/api2/leveranciers/47" // (suppliers) } }, "mag_type_wijzigen": false, // (may_change_type) "contactpersonen": [ // (contact_persons) { "id": 48, "voornaam": "Marthijn", // (first_name) "achternaam": "Wolting", // (last_name) "geslacht": "onbekend", // (gender: "unknown") "aanhef": "", // (salutation) "adres": "", // (address) "postcode": "", // (postal_code) "plaats": "", // (city) "telefoon1": "", // (phone1) "telefoon2": "", // (phone2) "email1": "", "email2": "", "hoofdcontact": true, // (main_contact) "nieuwsbrief_ids": [ ] // (newsletter_ids) } ] } :statuscode 200: OK :statuscode 301: Follow the http-referer in the 'Location' header for the contact. :statuscode 404: No contact with this ``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", // (name: "Example Group") "type": "klant", // (type: "customer") "adres": "Teststraat 1", // (address: "Test Street 1") "postcode": "1337 XD", // (postal_code) "plaats": "Teststad", // (city: "Test City") "landcode": "NL", // (country_code) "provinciecode": "NL-NH", // (province_code) "website": "https://www.recras.nl/", "btw_nummer": null, // (vat_number) "bedrijf_id": 1, // (company_id) "status": "actief", // (status: "active") "mag_type_wijzigen": false, // (may_change_type) "contactpersonen": [ // (contact_persons) { "id": 15, "hoofdcontact": false // (main_contact) }, { "voornaam": "Test", // (first_name) "achternaam": "Contactpersoon", // (last_name: "Contact Person") "geslacht": "man", // (gender: "male") "aanhef": null, // (salutation) "adres": "Teststraat 1", // (address: "Test Street 1") "postcode": "1337 XD", // (postal_code) "plaats": "Teststad", // (city: "Test City") "telefoon1": "0123456789", // (phone1) "email1": "test@example.com", "hoofdcontact": true // (main_contact) } ], "extra_fields": [ { "name": "Shoe size", "type": "number", "value": 42, } ] } :json string displaynaam: The display name of the relation (`displaynaam` means display_name) :json string naam: The internal name of the relation (`naam` means name) :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 (`adres` means address) :json string postcode: The postcode of the relation (`postcode` means postal_code) :json string plaats: The city of the relation (`plaats` means city) :json string landcode: An [ISO 3166-1](https://en.wikipedia.org/wiki/ISO_3166-1) country code (`landcode` means country_code) :json string provinciecode: An [ISO 3166-2](https://en.wikipedia.org/wiki/ISO_3166-2) subdivision code (`provinciecode` means province_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. (`bedrijf_id` means company_id) :json string btw_nummer: VAT number of the relation (`btw_nummer` means vat_number) :json string status: Is the relation active (``actief``) or not (``passief`` (passive)). Only valid for type ``leverancier`` (supplier) :json bool mag_type_wijzigen: Can this relation change type or not (`mag_type_wijzigen` means may_change_type) :json array contactpersonen: **Required** List of one or more contact persons (`contactpersonen`) 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 (`hoofdcontact`) 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 person (`contactpersoon`) When a new contact person is entered (see also ``/contactpersonen`` (contact_persons)) :json string voornaam: Given name of the contact person (`voornaam` means first_name) :json string achternaam: Family name of the contact person (`achternaam` means last_name) :json string geslacht: Gender of the contact person. Valid values are 'man' (male), 'vrouw' (female), 'onbekend' (unknown) (`geslacht` means gender) :json string aanhef: Salutation to use (`aanhef` means salutation) :json string adres: Address (`adres` means address) :json string postcode: Postcode (`postcode` means postal_code) :json string plaats: City (`plaats` means city) :json string telefoon1: Telephone 1 (`telefoon1` means phone1) :json string telefoon2: Telephone 2 (`telefoon2` means phone2) :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 ---------