MKG API Quote

This article contains the commonly used API calls for Quotes.

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.

 

Retrieve

 

Relation
For retrieving a debtor and/or relation, see this article.

 

List of Sellers

To retrieve a list of sellers, the following call can be used. The API uses pagination, offering a maximum of 1000 lines in one call.

GET {{restUrl}}/Documents/verk

  • Filter: verk_actief = true
  • Fieldlist: medw_num,verk_naam,verk_num
  • NumRows: 10
{{restUrl}}/Documents/verk/?Filter=verk_actief = true&Fieldlist=medw_num,verk_naam,verk_num&NumRows=10

 

Create

 

Relation
For creating a debtor and/or relation, see this article.

 

Sales Quote Header

To create a sales quote, a relation must be created to which it is linked. This relation is linked with the variable {{rela_num}}. It is possible to create a sales quote without a debtor being linked. However, a debtor is required to convert the quote into a sales order. When the debtor number is known, you do not need to include the relation number in the call.

POST {{restUrl}}/Documents/vofh

{{restUrl}}/Documents/vofh

Request body:

{
    "request": {
        "InputData": {
            "vofh": [
                {
                    "admi_num": {{admi_num}},
                    "rela_num": {{rela_num}},
                  "debi_num": {{debi_num}},
                    "vofh_ref_onze": "Our reference",
                    "vofh_ref_uw": "Customer reference",
                    "vofh_bestelcode_extern": "Customer order code"
                }
            ]
        }
    }
}

 

Sales Quote Line

To create a sales quote line, a sales quote must be created to which it is linked. The sales quote is linked with the variable {{vofh_num}}.

POST {{restUrl}}/Documents/vofr

{{restUrl}}/Documents/vofr

Request body:

{
    "request": {
        "InputData": {
            "vofr": [
                {
                    "vofh_num": {{vofh_num}},
                    "vofr_oms_1": "Sales quote line",
                    "vofr_order_aantal": 100,
                    "vofr_eenh_order": "pcs."
                }
            ]
        }
    }
}

 

Term Plan

A term plan in MKG is a template used for installment invoicing. You create the term plan once, after which you can repeatedly apply it to different sales orders. This makes it easier to arrange payments in installments, such as a prepayment, payment upon delivery, and a post-payment.

PUT{{restUrl}}/Documents/vofh/{{admi_num}}+{{vofh_num}}/Service/s_term_plan?DialogResult=1

{{restUrl}}/Documents/vofh/{{admi_num}}+{{vofh_num}}/Service/s_term_plan?DialogResult=1

Request body:

{
    "request": {
        "InputData": {
            "clcb": [
                {
                   "admi_num": 1,
                    "vofh_num": {{vofhnum}},
                  "t_tmph": 1,
                  "t_vofr_list": "1,2",
                  "t_tmph_datum": "2023-03-30",
                  "t_tmph_ingave": "2000.00",
                  "RowKey": 1
                }
            ]
        }
    }
}


Include Quote Line in Calculation

In MKG, the action Include in Calculation means creating a calculation for a sales quote, where the costs for materials, operations, and other production costs are calculated. When included in the calculation, a final product is also created immediately.

POST{{restUrl}}/Documents/vofr/{{admi_num}}+{{vofh_num}}+{{vofr_num}}/Service/s_actie_in_calculatie?FieldList=clch_num

{{restUrl}}/Documents/vofr/{{admi_num}}+{{vofh_num}}+{{vofr_num}}/Service/s_actie_in_calculatie?FieldList=clch_num

 

Add Calculation Semi-finished Products

After inclusion in the calculation, a final product is already created. A calculation may not have more than one final product. With the following call, you can add a semi-finished product under the final product.

POST {{restUrl}}/Documents/clcr/

{{restUrl}}/Documents/clcr/

Request body:

{
    "request": {
        "InputData": {
            "clcr": [
                {
                    "admi_num": {{admi_num}},
                    "clch_num": {{clch_num}},
                    "clcr_parent": 1,
                    "arti_code": "TEST ARTICLE",
                    "clcr_oms_1": "API final product",
                    "clcr_tot_aantal": 10
                }
            ]
        }
    }
}

 

Add Calculation Materials

POST {{restUrl}}/Documents/clcm/

{{restUrl}}/Documents/clcm/

Request body:

{
    "request": {
        "InputData": {
            "clcm": [
                {
                  "admi_num": {{admi_num}},
                  "clch_num": {{clch_num}},
                  "clcr_num": {{clcr_num}},
                  "arti_code": "TEST ARTICLE",
                  "clcm_aantal": 10,
                  "clcm_oms_1": "API material test"
                }
            ]
        }
    }
}

 

Add Calculation Operations

POST {{restUrl}}/Documents/clcb/

{{restUrl}}/Documents/clcb/

Request body:

{
    "request": {
        "InputData": {
            "clcb": [
                {
                  "admi_num": {{admi_num}},
                  "clch_num": {{clch_num}},
                  "clcr_num": {{clcr_num}},
                  "bwrk_num": 1000,
                  "clcb_instel_tijd": 10,
                  "clcb_tijd_per_stuk": 10
                }
            ]
        }
    }
}