MKG API Article + Bill of Materials

This article contains the frequently used API calls for Articles and Bills of Materials.

Tested on API V3 and MKG Version 005.91.014.


Table of Contents


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

 

Postman
For examples of API calls, see this article.

 

Intermediate Product Structure

In a bill of materials, you can add multiple lines. Line 1 is often the end product. When you add a new line, you can indicate via the Parent field that this line is part of another line. This creates a tree structure of end product, intermediate products, and sub-intermediate products.

For example:
Line 2 gets parent = 1 → line 2 is an intermediate product of the end product in line 1.
Line 3 gets parent = 2 → line 3 is an intermediate product of line 2 (thus a subcomponent).
Line 4 gets parent = 1 → line 4 is also an intermediate product directly under line 1.
Line 5 gets parent = 4 → line 5 is an intermediate product of line 4.
This way, you build a hierarchy of components within a single bill of materials.
 
Line 1: End Product
├── Line 2: Intermediate Product of Line 1
│    └── Line 3: Intermediate Product of Line 2
├── Line 4: Intermediate Product of Line 1
│    └── Line 5: Intermediate Product of Line 4

 

Retrieve

 

Search Article

When you want to manually search for articles in MKG, you can use the following GET request to gradually display a list of possibilities. Enter the article to search for under 'Search'.

GET {{restUrl}}/Documents/arti

  • Filter: admi_num = {{admi_num}} AND arti_actief = true AND Search = "search text" 
  • FieldList: arti_code,arti_oms_1,arti_oms_2,arti_oms_3 
  • Sort: arti_code
  • NumRows: 10
{{restUrl}}/Documents/arti?Filter=admi_num = {{admi_num}} AND arti_actief = true AND Search = "search text"&FieldList=arti_code,arti_oms_1,arti_oms_2,arti_oms_3&Sort=arti_code&NumRows=10

 

List of Articles

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

GET {{restUrl}}/Documents/arti

  • Filter: admi_num = {{admi_num}} AND arti_actief = true AND ...
  • FieldList: arti_code,arti_oms_1,arti_oms_2,arti_oms_3,... 
  • Sort: arti_code
  • NumRows: 100
  • SkipRows: 0
{{restUrl}}/Documents/arti?Filter=admi_num = {{admi_num}} AND arti_actief = true&FieldList=arti_code,arti_oms_1,arti_oms_2,arti_oms_3&Sort=arti_code&NumRows=100&SkipRows=0

 

Specific Article

To retrieve a specific article, there are two options, namely with the primary key and with the rowkey. The rowkey is included with each GET request and is unique in combination with the endpoint.

GET {{restUrl}}/Documents/arti/{{admi_num}}+{{arti_code}}

GET {{restUrl}}/Documents/arti/{{RowKey}}

  • FieldList: arti_code,arti_actief,arti_oms_1,arti_oms_2,arti_oms_3,arti_eenh_vrd,arti_stlh_num,... 
{{restUrl}}/Documents/arti/{{admi_num}}+{{arti_code}}?FieldList=arti_code,arti_actief,arti_oms_1,arti_oms_2,arti_oms_3,arti_eenh_vrd,arti_stlh_num

 

Retrieve Specific Bill of Materials

The bill of materials header (stlh) only contains the bill of materials number. The connection of a bill of materials with an article is at the end product of the bill of materials. Since a bill of materials can only have one end product, this will always be bill of materials line 1.

The table structure of a bill of materials:

stlh - Bill of Materials Header
- stlr - End Product (stlr_num = 1)
-- stlm - Materials
-- stlb - Operations
-- stlr - Intermediate Products (stlr_parent = 1)
--- stlm - Materials
--- stlb - Operations
--- stlr - Intermediate Products (stlr_parent = ...)
---- etc..

GET  {{restUrl}}/Documents/stlr/{{admi_num}}+{{stlh_num}}+{{stlr_num}}

  • FieldList: stlh_num,stlh_num.stlh_actief,stlr_num,arti_code,stlr_oms_1,stlr_oms_2,stlr_oms_3
  {{restUrl}}/Documents/stlr/{{admi_num}}+{{stlh_num}}+{{stlr_num}}?FieldList=stlh_num,stlh_num.stlh_actief,stlr_num,arti_code,stlr_oms_1,stlr_oms_2,stlr_oms_3

 

Bill of Materials Materials

This bill of materials uses the collection of materials at the bill of materials line (stlr) endpoint.

GET {{restUrl}}/Documents/stlr/{{admi_num}}+{{stlh_num}}+{{stlr_num}}/stlr_stlm

  • FieldList: stlm_num,arti_code,stlm_oms_1,stlm_oms_2,stlm_oms_3,stlm_aantal,stlm_eenh,... 
  • Sort: stlm_num
{{restUrl}}/Documents/stlr/{{admi_num}}+{{stlh_num}}+{{stlr_num}}/stlr_stlm?FieldList=stlh_num,stlh_num.stlh_actief,stlr_num,arti_code,stlr_oms_1,stlr_oms_2,stlr_oms_3

 

Create

 

Article

To create articles, we use profiles in MKG (article template). In the Articles module, it is possible to create multiple profiles, with which all relevant information is automatically filled by MKG.

The advice is to create at least the following profiles in consultation with the MKG consultant. Multiple variants can be created per advised profile due to differences in the desired financial handling (purchase/sale/inventory groups).

Profile Article Purchase Inventory Costs After Optimization
7000 Purchase inventory driven true true false Material
7100 Purchase order driven true false false Material
7200 Purchase costs true true true Material
7300 Production/sale inventory driven false true false Material
7400 Production/sale order driven false false false Intermediate Product
7999 Unknown/default * * * *

 

By using profiles, entering the basic information suffices.

POST {{restUrl}}/Documents/arti/?Profile={{profile_num}}

{{restUrl}}/Documents/arti/?Profile={{profile_num}}

Request body:

{
    "request": {
        "InputData": {
          "arti": [
                {
                  "arti_code": "Article name",
                  "arti_eenh_vrd": "st.",
                  "btwc_code": 1,
                    "vrkg_num": {{vrkg_num}},
                  "inkg_num": 1,
                    "prdg_num": {{prdg_num}},
                    "vrdg_num": {{vrdg_num}},
                  "arti_actief": true
                }
            ]
        }
    }
}

 

 

Create VRM Article

Within MKG, you can also use VRM (Accelerated Calculation Method) articles.
These are articles where all parameters and trading length are recorded on the article, and consumption can be specified on the bill of materials Materials. 

The advice is to have VRM articles created by the MKG user in MKG and then adopted.
VRM articles are recognized by the Formula field (matf_num) that is filled on the article.

 

Create Bill of Materials Header

POST {{restUrl}}/Documents/stlh/

{{restUrl}}/Documents/stlh/

Request body:

{
    "request": {
        "InputData": {
            "stlh": [
                {
                    "admi_num": {{admi_num}},
                    "stlh_actief": true,
                    "stlh_memo": "Memo text"
                }
            ]
        }
    }
}

 

Create Bill of Materials Line

POST {{restUrl}}/Documents/stlr/

{{restUrl}}/Documents/stlr/

Request body:

{
    "request": {
        "InputData": {
            "stlr": [
                {
                    "admi_num": {{admi_num}},
                    "stlh_num": "{{stlh_num}}",
                  "arti_code": "{{arti_code}}"
              } ] } } }

 

Create Bill of Materials Materials

Add all necessary materials to the bill of materials line.

POST {{restUrl}}/Documents/stlr/{{admi_num}}+{{stlh_num}}+{{stlr_num}}/stlr_stlm

{{restUrl}}/Documents/stlr/{{admi_num}}+{{stlh_num}}+{{stlr_num}}/stlr_stlm

Request body:

{
    "request": {
        "InputData": {
            "stlm": [
                {
                    "arti_code": "{{arti_code}}",
                  "stlr_aantal": 1,
                  "eenh_code": "st."                 } ] } } }

 

Create Bill of Materials VRM Materials

Within MKG, VRM (Accelerated Calculation Method) articles can also be used.
These are articles where the trading length is recorded on the article, and consumption can be specified on the bill of materials Materials.

For VRM articles, all parameters are fixed on the article. On the bill of materials Materials, the quantity and required length can be specified.

POST {{restUrl}}/Documents/stlr/{{admi_num}}+{{stlh_num}}+{{stlr_num}}/stlr_stlm

{{restUrl}}/Documents/stlr/{{admi_num}}+{{stlh_num}}+{{stlr_num}}/stlr_stlm

Request body:

{
    "request": {
        "InputData": {
            "stlm": [
                {
                    "arti_code": "{{arti_code}}",
                  "stlr_aantal": 1,
                  "eenh_code": "st.",
                  "stlm_lengte": "100", // The length is always in millimeters
                  "stlm_behoefte_obv": 3 // Requirement based on product length and trading length (PL/HL)                 } ] } } }

 

Actions

 

Update Revision

With this PUT call, you can perform a revision calculation for an article in MKG, indicating which parts of the bill of materials (end products, intermediate products, and materials) should be included in the revision.

PUT{{restUrl}}/Documents/arti/{{arti_code}}/Service/s_recalc_revisie

{{restUrl}}/Documents/arti/{{arti_code}}/Service/s_recalc_revisie
 

Request body:

{
    "request": {
        "InputData": {
            "PartListRevision": [
                {
                    "RowKey": "X",
                  "t_eind": "true",
                  "t_half": "true",
                  "t_mat": "true"
                }
            ]
        }
    }
}