MKG API Relationships

This article contains the commonly used API calls for Relationships.

Tested on API V3 and MKG Version 005.090.002.


Table of Contents


Data Dictionary
For information on endpoints, fields, and actions, see this article.

 

Postman
For examples of API calls, see this article.

 

Query

 

Relationship

A relationship only becomes a debtor (customer) or creditor (supplier) when a debtor or creditor is linked to the relationship.

Note!
A relationship can be both a debtor and a creditor. Relationships are cross-administration, but debtors and creditors are not.

The relationship structure is composed as follows:

  • Rela
    • cprs
    • adrs
    • cred
    • debi

Search Relationship

To manually search for a relationship, you can use the following GET request to gradually display a list of possibilities. Enter the relationship to be searched in 'Search'.

GET {{restUrl}}/Documents/rela

  • Filter: Search = “Search text”
  • Fieldlist: rela_num,rela_naam,rela_telefoon,rela_email,rela_www
  • NumRows: 10
{{restUrl}}/Documents/rela/?Filter=Search = "Search text"&NumRows=10&FieldList=rela_num,rela_naam,rela_telefoon,rela_email,rela_www

 

Specific Relationship

To query a specific relationship, there are two options: with the primary key and with the row key. The row key accompanies each GET request and is unique in combination with the endpoint.

GET {{restUrl}}/rela/ {{rela_num}}

GET {{restUrl}}/rela/ {{RowKey}}

  • Fieldlist: rela_num,rela_naam,rela_telefoon,rela_email,rela_www
{{restUrl}}/Documents/rela/{{rela_num}}/?FieldList=rela_num,rela_naam,rela_telefoon,rela_email,rela_www

 

List of Relationships

To query a list of relationships, you can use the following call. The API uses pagination, offering a maximum of 1000 rows in one call.

GET {{restUrl}}/Documents/rela

  • Filter: rela_actief = true
  • Fieldlist: rela_num,rela_naam,rela_telefoon,rela_email,rela_www
  • NumRows: 1000
  • Skiprows: 0
{{restUrl}}/Documents/rela/?Filter=rela_actief = true &FieldList=rela_num,rela_naam,rela_telefoon,rela_email,rela_www&NumRows=1000&SkipRows=0

 

Search Debtor

When a user wants to manually search for a relationship, the following GET request can be used to gradually display a list of possibilities. Enter the debtor to be searched in 'Search'.

GET {{restUrl}}/Documents/debi

  • Filter: Search = “Search text”
  • Fieldlist: debi_num,debi_naam,rela_num,debi_email,debi_kvk_num
  • NumRows: 10
{{restUrl}}/Documents/debi/?Filter=Search = "Search text"&NumRows=10&FieldList=debi_num,debi_naam,rela_num,debi_email,debi_kvk_num

 

Specific Debtor

To query a specific debtor, there are two options: with the primary key and with the rowkey. The rowkey accompanies each GET request and is unique in combination with the endpoint.

GET {{restUrl}}/debi/ {{admi_num}}+{{debi_num}}

GET {{restUrl}}/debi/ {{RowKey}}

  • Fieldlist: debi_num,debi_naam,rela_num,debi_email,debi_kvk_num
{{restUrl}}/Documents/debi/{{admi_num}}+{{debi_num}}/?FieldList=debi_num,debi_naam,rela_num,debi_email,debi_kvk_num

 

List of Debtors

To query a list of debtors, the following call can be used. The API uses pagination, offering a maximum of 1000 rows in one call.

GET {{restUrl}}/Documents/debi

  • Filter: debi_actief = true
  • NumRows: 1000
  • Skiprows: 0
  • Fieldlist: debi_num,debi_naam,rela_num,debi_email,debi_kvk_num
{{restUrl}}/Documents/debi?Filter=debi_actief = true&NumRows=100&SkipRows=0&FieldList=debi_num,debi_naam,rela_num,debi_email,debi_kvk_num

 

Search Creditor

To manually search for a creditor, the following GET request can be used to gradually display a list of possibilities. Enter the creditor to be searched in 'Search'.

GET {{restUrl}}/Documents/cred

  • Filter: Search = “Search text”
  • Fieldlist: cred_num,cred_naam,rela_num,cred_email,cred_kvk_num
  • NumRows: 10
{{restUrl}}/Documents/debi/?Filter=Search = "Search text"&NumRows=10&FieldList=cred_num,cred_naam,rela_num,cred_email,cred_kvk_num

 

Specific Creditor

To query a specific creditor, there are two options: with the primary key and with the rowkey. The rowkey accompanies each GET request and is unique in combination with the endpoint.

GET {{restUrl}}/cred/ {{admi_num}}+{{cred_num}}

GET {{restUrl}}/cred/ {{RowKey}}

  • Fieldlist: cred_num,cred_naam,rela_num,cred_email,cred_kvk_num
{{restUrl}}/Documents/cred/{{admi_num}}+{{cred_num}}/?FieldList=cred_num,cred_naam,rela_num,cred_email,cred_kvk_num

 

List of Creditors

To query a list of creditors, the following call can be used. The API uses pagination, offering a maximum of 1000 rows in one call.

GET {{restUrl}}/Documents/cred

  • Filter: cred_actief = true
  • NumRows: 1000
  • Skiprows: 0
  • Fieldlist: cred_num,cred_naam,rela_num,cred_email,cred_kvk_num
{{restUrl}}/Documents/cred?Filter=cred_actief = true&NumRows=100&SkipRows=0&FieldList=cred_num,cred_naam,rela_num,cred_email,cred_kvk_num

 

Create

 

Relationship

POST {{restUrl}}/Documents/rela

{{restUrl}}/Documents/rela

Request body:

{
    "request": {
        "InputData": {
            "rela": [
                {
                  "rela_naam": "Relation name",
                  "rela_telefoon": "Phone number",
                  "rela_email": "Relation e-mail",
                  "rela_www": "Relation website",
                  "rela_actief": true
                }
            ]
        }
    }
}

 

Address

To add an address, a relationship must first exist to which the address can be linked. You then use this relationship number in the call with the variable {{rela_num}}.

POST {{restUrl}}/Documents/adrs

{{restUrl}}/Documents/adrs

Request body:

{
    "request": {
        "InputData": {
            "adrs": [
                {
                    "rela_num": {{rela_num}},
                    "adrs_actief": true,
                    "adrs_straat": "Street name",
                    "adrs_nummer": 99, 
                    "adrs_postcode": "ZIP code",
                    "adrs_plaats": "City",
                    "land_code": "NL"
                }
            ]
        }
    }

 

Contact Person

To create a debtor, a relationship must first exist to which the debtor is linked. You then use this relationship number in the call with the variable {{rela_num}}.

POST {{restUrl}}/Documents/cprs

{{restUrl}}/Documents/cprs

Request body:

{
    "request": {
        "InputData": {
            "cprs": [
                {
                    "rela_num": {{rela_num}},
                    "cprs_actief": true,
                    "cprs_voorletters": "F.",
                    "cprs_voornaam": "Firstname", 
                    "cprs_tussenvoegsel": "Prepos",
                    "cprs_naam": "Lastname"
                }
            ]
        }
    }

 

Debtor

To create a debtor, a relationship must first exist to which the debtor is linked. You then use this relationship number in the call with the variable {{rela_num}}.

POST {{restUrl}}/Documents/debi

{{restUrl}}/Documents/debi

Request body:

{
    "request": {
        "InputData": {
            "debi": [
                {
                    "rela_num": {{rela_num}},
                    "debi_actief": true,
                  "debi_btw_num": "VAT number",
                  "debi_kvk_num": "KVK number",
                  "debi_email": "E-mail"
                }
            ]
        }

 

Creditor

To create a creditor, a relationship must first exist to which the creditor is linked. You then use this relationship number in the call with the variable {{rela_num}}.

POST {{restUrl}}/Documents/cred

{{restUrl}}/Documents/cred

Request body:

{
    "request": {
        "InputData": {
            "cred": [
                {
                    "rela_num": {{rela_num}},
                    "cred_actief": true,
                  "cred_btw_num": "VAT number",
                  "cred_kvk_num": "KVK number",
                  "cred_email": "E-mail"

                }
            ]
        }