API - Webshop

Collection of common calls used for a webshop integration.

The following calls are examples from which further development can proceed. The configuration of the MKG environment may require adjustments to the calls.

 

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

 

For examples of API calls see our Postman API Collection.

 

Retrieve Articles

Example of a call that returns all active articles from a specific administration and article group that are not blocked for sale.
Using pagination.

Assumption for this call is that the article group determines whether an article can be displayed within the webshop.

GET {{restUrl}}/Documents/arti?Filter=admi_num = {{admi_num}} AND arti_actief = true AND arti_blok_verkoop = false AND artg_num = {{artg_num}}&NumRows=100&SkipRows=0&FieldList=arti_code,arti_oms_1,arti_oms_2,arti_oms_3,arti_eenh_vrd&Sort=arti_code

 

Retrieve Article Stock

Example of a call that returns the current stock level for a specific article.

GET{{restUrl}}/Documents/arti/{{admi_num}}+{{arti_num}}?FieldList=arti_code,t_vrd_fys_vrij

 

Create Relationship and Debtor

Assumption is that existing debtors are already known within the webshop. 

To create a debtor, a relationship with an address and a contact person must first be created.
Then, a debtor can also be created for this relationship.

Good to know: Relationships are administration-wide, debtors are administration-dependent.

Relationship (rela)

|- Addresses (adrs)

|- Contact persons (cprs)

|- Debtors (debi)

 

Example of a call to create a new relationship.

POST {{restUrl}}/Documents/rela/
Body:

{
    "request": {
        "InputData": {
            "rela": [
                {

                    "rela_actief": true,
                    "rela_naam": "Relation name",
                    "rela_telefoon": "Relation telephone number",
                    "rela_email": "Relation e-mail address",
                    "rela_www": "Relation website"
                }
            ]
        }
    }
}

 

Example of a call to add an address to the relationship.

POST {{restUrl}}/Documents/rela/{{rela_num}}/rela_adrs/
Body:

{
    "request": {
        "InputData": {
            "adrs": [
                {
                    "adrs_actief": true,
                    "adrs_straat": "Street name",
                    "adrs_nummer": 99, 
                    "adrs_postcode": "ZIP code",
                    "adrs_plaats": "City",
                    "land_code": {{land_code}},
                    "adrs_vrk_offerte": true,
                    "adrs_vrk_order": true,
                    "adrs_vrk_pakbon": true,
                    "adrs_vrk_factuur": true
               }
            ]
        }
    }
}

 

Example of a call to add a contact person to the relationship.

POST {{restUrl}}/Documents/rela/{{rela_num}}/rela_cprs/
Body:

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

 

Example of a call to add a debtor to the relationship.

POST {{restUrl}}/Documents/debi/
Body:

{
    "request": {
        "InputData": {
            "debi": [
                {
                    "rela_num": {{rela_num}},
                    "debi_actief": true,
                    "debi_email": "billing email address",
                    "debi_btw_num": "VAT number"
                }
            ]
        }
    }
}

Create Sales Order

A sales order consists of a header and line(s). 

Example of a call to create a sales order header.

POST{{restUrl}}/Documents/vorh/
Body:

{
    "request": {
        "InputData": {
            "vorh": [
                {
                    "admi_num": {{admi_num}},
                    "debi_num": {{debi_num}},
                    "vorh_ref_onze": "Our reference",
                    "vorh_ref_uw": "Customer reference",
                    "vorh_bestelcode_extern": "Customer order code"
                }
            ]
        }
    }
}



Example of a call to create a sales order line.
POST  {{restUrl}}/Documents/vorh/{{admi_num}}+{{vorh_num}}/vorh_vorr/
Body:

{
    "request": {
        "InputData": {
            "vorr": [
                {
                    "vorr_oms_1": "Sales order line",
                    "vorr_order_aantal": 100,
                    "vorr_eenh_order": "st."
                }
            ]
        }
    }
}

 

A term plan can be used to create a (term) invoice for the actual delivery.
This is based on predefined term plans in MKG where the number of terms and the distribution are known.
Only one term plan can be linked per sales order.

Example of a call to create a term plan for multiple sales order lines of a sales order:
PUT  {{restUrl}}/Documents/vorh/{{admi_num}}+{{vorh_num}}/Service/s_term_plan?DialogResult=1

Body:

{
    "request": {
        "InputData": {
            "vorh": [
                {
                    "admi_num": {{admi_num}},                       // Administration number
                    "vorh_num": {{vorh_num}},                       // Sales order number
                    "t_tmph": {{tmph_num}},                         // Choice which term plan
                    "t_vorr_list": "{{vorr_num}},{{vorr_num}}",     // Selecting sales order lines for the purpose of the term plan. So to which the term plan should apply
                    "t_tmph_datum": "yyyy-mm-dd",                   // First expiry date. Optional
                    "t_tmph_ingave": "2000.00",                     // Entry amount
                    "RowKey": 1                                     // Required to include
                }
            ]
        }
    }
}