Contacts (Contacten)

Current version: 0.2.0

Read

GET /api2/contacten

List of contacts in Recras. This displays contacts of all types.

Example request:

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

Example response:

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)
          }
      ]
   }
]
Status Codes:
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:

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

Example response:

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)
       }
   ]
}
Status Codes:

Create

POST /api2/contacten

Create a relation

Example request:

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 Parameters:
  • displaynaam (string) – The display name of the relation (displaynaam means display_name)

  • naam (string) – The internal name of the relation (naam means name)

  • type (string) – 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)

  • adres (string) – The address of the relation (adres means address)

  • postcode (string) – The postcode of the relation (postcode means postal_code)

  • plaats (string) – The city of the relation (plaats means city)

  • landcode (string) – An [ISO 3166-1](https://en.wikipedia.org/wiki/ISO_3166-1) country code (landcode means country_code)

  • provinciecode (string) – An [ISO 3166-2](https://en.wikipedia.org/wiki/ISO_3166-2) subdivision code (provinciecode means province_code)

  • website (string) – The website of the relation

  • bedrijf_id (int) – 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)

  • btw_nummer (string) – VAT number of the relation (btw_nummer means vat_number)

  • status (string) – Is the relation active (actief) or not (passief (passive)). Only valid for type leverancier (supplier)

  • mag_type_wijzigen (bool) – Can this relation change type or not (mag_type_wijzigen means may_change_type)

  • contactpersonen (array) – 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.

  • contactpersonen.hoofdcontact (boolean) – 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.

  • extra_fields (array) – 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 Parameters:
  • contactpersonen.id (int) – id of the contact person (contactpersoon)

When a new contact person is entered (see also /contactpersonen (contact_persons))

JSON Parameters:
  • voornaam (string) – Given name of the contact person (voornaam means first_name)

  • achternaam (string) – Family name of the contact person (achternaam means last_name)

  • geslacht (string) – Gender of the contact person. Valid values are ‘man’ (male), ‘vrouw’ (female), ‘onbekend’ (unknown) (geslacht means gender)

  • aanhef (string) – Salutation to use (aanhef means salutation)

  • adres (string) – Address (adres means address)

  • postcode (string) – Postcode (postcode means postal_code)

  • plaats (string) – City (plaats means city)

  • telefoon1 (string) – Telephone 1 (telefoon1 means phone1)

  • telefoon2 (string) – Telephone 2 (telefoon2 means phone2)

  • email1 (string) – Email address 1

  • email2 (string) – Email address 2

Status Codes:

Update

PUT /api2/contacten/(int: id)

Update a relation

Body contains the same field as for the Create action

Changelog