MKG API Inventory

This article contains the frequently used API calls for Inventory.

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.

 

Retrieve

Article
For retrieving and creating an article, see this article.

 

Batch List

To retrieve a batch list, the following call can be used: 

GET {{restUrl}}/Documents/part?FieldList=arti_code,part_num,t_aant_vrij,part_blok,arti_zoeknaam&Sort=part_num

{{restUrl}}/Documents/part?FieldList=arti_code,part_num,t_aant_vrij,part_blok,arti_zoeknaam&Sort=part_num

 

Specific Batch

To retrieve a specific batch, the following call can be used: 

GET {{restUrl}}/Documents/part?FieldList=arti_code,part_num,t_aant_vrij,part_blok,arti_zoeknaam&Filter=t_aant_vrij > 0.0 and part_blok = false and part_num = 001I250801009&Sort=part_num

{{restUrl}}/Documents/part?FieldList=arti_code,part_num,t_aant_vrij,part_blok,arti_zoeknaam&Filter=t_aant_vrij > 0.0 and part_blok = false and part_num = 001I250801009&Sort=part_num

 

Batch Rowkey

To retrieve the rowkey of a batch, the following call can be used: 

GET {{restUrl}}/Documents/pamt/?Filter=part_num = {{part_num}}&FieldList=part_num,pamt_type&Sort=pamt_type 

{{restUrl}}/Documents/pamt/?Filter=part_num = {{part_num}}&FieldList=part_num,pamt_type&Sort=pamt_type

 

Warehouse

To retrieve a warehouse, the following call can be used: 

GET {{restUrl}}/Documents/magl/?FieldList=magl_code,magl_oms_1

{{restUrl}}/Documents/magl/?FieldList=magl_code,magl_oms_1

 

Retrieve Inventory List

To retrieve an inventory list, the following call can be used: 

GET {{restUrl}}/Documents/StockRevaluation/0/t_list?Filter=Article={{arti_code}} and Location={{magl_code}}&FieldList=t_arti,t_part,t_magl,t_aantal,t_verdicht

{{restUrl}}/Documents/StockRevaluation/0/t_list?Filter=Article={{arti_code}} and Location={{magl_code}}&FieldList=t_arti,t_part,t_magl,t_aantal,t_verdicht

 

Retrieve Batches at Location

To retrieve all batches located at a specific location, the following call can be used: 

GET {{restUrl}}/Documents/parl/?Filter=magl_code = {{magl_code}} &FieldList=part_num,parl_aantal,eenh_code,t_arti_code

{{restUrl}}/Documents/parl/?Filter=magl_code = {{magl_code}} &FieldList=part_num,parl_aantal,eenh_code,t_arti_code

 

Create

 

Batch

To create a batch, you can use the following call:

POST {{restUrl}}/Documents/part

{{restUrl}}/Documents/part

Request body:

{
    "request": {
        "InputData": {
            "part": [
                {
                  "arti_code": "{{arti_code}}",
                  "t_mut_aantal": 1000
                }
            ]
        }
    }
}

 

Warehouse

To create a warehouse, you can use the following call:

POST {{restUrl}}/Documents/magz

{{restUrl}}/Documents/magz

Request body:

{
    "request": {
        "InputData": {
            "magz": [
                {
                    "adma_num": {{adma_num}},
                  "admi_num": 1,
                  "magz_blok": false,
                  "magz_code": "99",
                  "magz_memo": "",
                  "magz_niet_autores": false,
                  "magz_oms_1": "Main warehouse",
                  "magz_oms_2": "",
                  "magz_oms_3": ""
                }
            ]
        }
    }
}

 

Warehouse Locations

To create a warehouse location, you can use the following call:

POST {{restUrl}}/Documents/magl

{{restUrl}}/Documents/magl

Request body:

{
    "request": {
        "InputData": {
            "magl": [
                {
                  "admi_num": 1,
                  "magl_blok": false,
                  "magz_code": "",
                  "magl_memo": "",
                  "magl_niet_autores": false,
                  "magl_oms_1": "Main warehouse location descr",
                  "magl_oms_2": "",
                  "magl_oms_3": "",
                  "magl_shopfloor": false,
                  "magl_code": "{{mgl_code}}"
                }
            ]
        }
    }
}
 

 

Actions

 

Revalue Inventory

To revalue inventory, use the following call:

PUT{{restUrl}}/Documents/StockList/x/Service/s_savestocklist?FieldList=pamt.part_num

{{restUrl}}/Documents/StockList/x/Service/s_savestocklist?FieldList=pamt.part_num

Request body:

{
    "request": {
        "InputData": {
            "StockListSaveInfo": [
                {
                    "RowKey": 1,
                    "t_datum": "{{TodayReverse}}",
                    "t_delete_res": false 
                }
            ],
            "StockList": [
                {
                    "RowKey": 1,
                  "t_arti": "{{arti_code}}",
                  "t_part": "{{part_num}}",
                  "t_magl": "{{magl_code}}",
                  "t_invoer": {{getal}},
                    "RowNew":  0,
                    "t_verwerk": true
                }
            ],
            "StockRevaluation": [
                {
                    "RowKey": 1,
                    "t_obv": 1
                }
            ]
        }
    }
}

 

Create Reservation

To create a reservation of material for a production order line, use the following call:

PUT{{restUrl}}/Documents/prmv/{{admi_num}}+{{prdh_num}}+{{prdr_num}}+{{prmv_num}}/Service/s_createreservation

{{restUrl}}/Documents/prmv/{{admi_num}}+{{prdh_num}}+{{prdr_num}}+{{prmv_num}}/Service/s_createreservation

Request body:

{
    "request": {
        "InputData": {
            "Reservation": [
                {
                  "t_eenh_reservering": "st.",
                  "t_afgewerkt": true,
                  "t_uitgeven": false,
                  "t_uitgifte_datum": "2023-04-06",
                  "RowKey": 1
                }
            ],
            "StockAvailableList": [
                {
                  "RowKey": 1,
                  "t_ingave": 1,
                  "t_link_aantal": 1,
                  "t_pamt_row": "0x0000000003c14e6d"
                }
            ]
        }
    }
}

 

Delete Reservation

To delete a reservation of material for a production order line, use the following call:

PUT{{restUrl}}/Documents/prmv/0/Service/s_deletereservations

{{restUrl}}/Documents/prmv/0/Service/s_deletereservations

Request body:

{
    "request": {
        "InputData": {
             "t_selected_rows": [
                {
                  "t_value": "0x00000000000b24a0"
                },
                {
                  "t_value": "0x00000000000b2503"
                }
            ]
        }
    }
}