Contacten

Huidige versie: 0.2.0

Read

GET /api2/contacten

Lijst van contacten in Recras. Dit geeft contacten van alle types weer.

Voorbeeld request:

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

Voorbeeld response:

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

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

Voorbeeld response:

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": [ ]
       }
   ]
}
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",
   "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 Parameters:
  • displaynaam (string) – The display name of the relation

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

  • 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

  • postcode (string) – The postcode of the relation

  • plaats (string) – The city of the relation

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

  • provinciecode (string) – An [ISO 3166-2](https://en.wikipedia.org/wiki/ISO_3166-2) subdivision 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.

  • btw_nummer (string) – VAT number of the relation

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

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

  • contactpersonen (array) – Required List of one or more contact persons 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 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 persoon

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

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

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

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

  • aanhef (string) – Salutation to use

  • adres (string) – Address

  • postcode (string) – Postcode

  • plaats (string) – City

  • telefoon1 (string) – Telephone 1

  • telefoon2 (string) – Telephone 2

  • 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