Documentation to Support Usage Scenarios
To support the various managed usage scenarios, some use cases are provided as examples.
Although the use of services allows for implementations different from those specified, it is reminded that the supported functionalities are those described in the indicated Use Cases.
General Master Data
Default 'ditta' field in data transfer objects (DTO)
In POST requests to insert new records or documents, it is possible to specify the 'ditta' or 'dittaCg18' field.
A practical example: You want to insert a document with document type C-DDT for customer 1 and for company 1000.
Until version 202403000, The 'ditta' field had to be defined for each property of the body, so it was necessary to populate the 'ditta' or 'dittaCg18' field as shown in the JSON example below::
{
"ditta": '1000',
"valutaCg08": "EURO",
"anagraficaDocumentoDitta": {
"dittaCg18": '1000',
"codDocumMg36": "C-DDT",
"indStaperMg36": 1.0
},
"customerSupplierMG": {
"dittaCg18": '1000',
"tipocfCg40": 1,
"cliFor": 1
},
"sezdoc": "00",
"storageWH": {
"dittaCg18": '1000',
"codDep": "00"
},
"righe": [
{
"ditta": '1000',
"progrRiga": 1.0,
"codartMg66": "ART001",
"descart": "Descrizione articolo",
"qta1": 15.000
}
]
}
From version 202501000 a default logic for the 'ditta' field in Data Transfer Objects (DTO) has been introduced, so if the value of the 'ditta' field of the "root" entity is not provided or is null, it is automatically populated with the company code retrieved from the current user session (parameter 'company'). This operation propagates to all associated 'external' and 'internal' entities.
Consequently, considering the example above, the user always has the same POST request.:
{{webapi_base_url}}/api/v1/{{scope}}/MG/Documento?company=1000
but in the body properties, it is no longer necessary to define the 'ditta' or 'dittaCg18' field, as shown in the JSON example below:
{
"valutaCg08": "EURO",
"anagraficaDocumentoDitta": {
"codDocumMg36": "C-DDT",
"indStaperMg36": 1.0
},
"customerSupplierMG": {
"tipocfCg40": 1,
"cliFor": 1
},
"sezdoc": "00",
"storageWH": {
"codDep": "00"
},
"righe": [
{
"progrRiga": 1.0,
"codartMg66": "ART001",
"descart": "Descrizione articolo",
"qta1": 15.000
}
]
}
Note: If the 'ditta' field is defined in a body property, it must be defined in all properties that make up the body.
Search for an Accounting Reason Code
To search for an accounting reason code, you must use a POST request. Here is an example:
{{webapi_base_url}}/{{api}}/v2/{{scope}}/CO/AccountingReasonCodeCO/search?company={{azienda}}&getTotalCount=true
{
"filters": {
"items": [
{
"operator": 0,
"propertyName": "alias",
"comparer": 0,
"value": "FTV1"
}
]
},
"pageSize": 0,
"pageNumber": 0
}
Minimal Insertion of General Master Data
To insert a minimal general master record, you must use a POST request. Here is an example:
{{webapi_base_url}}/{{api}}/V2/{{scope}}/co/generalmasterdataco?company={{azienda}}
{
"city": "Misano",
"genderType": 0.0,
"isEInvoicingEnabled": 0,
"isExcludedFromBlacklist": 0.0,
"isMasterDataForHomonymMerge": 0.0,
"isNaturalPerson": 0.0,
"isValidGeneralMasterData": 1.0,
"legalName": "Anagrafica test WebApi ",
"nationCode": 86.0,
"taxCity": "Misano",
"taxLegalName": "Anagrafica prova WebApi",
"taxNationCode": 86.0
}
Minimal Insertion of a Customer/Supplier
To insert a customer or supplier, it is necessary to have previously inserted the common master data and, when inserting a customer, indicate the corresponding common master data code, as shown in the example below:
{{webapi_base_url}}/{{api}}/v2/{{scope}}/co/CustomerSupplierCO?company={{azienda}}
{
"customerSupplierType": 0,
"generalMasterDataCode": 980,
"paymentTermCode": "201",
"blackListGeneralMasterDataCode": 4,
"csAccountingIndexCode": "CATF",
"currencyCode": "EURO",
"AgenteCode" : "Agente",
"OfficeCode": 1,
"VatCode": 22,
"additionalInformation": {
"macroAreaCode": "UE",
"areaCode": "ITA",
"zoneCode": null,
"macrocategoryCode": "MCQ",
"categoryCode": "CA1",
"subCategory": "SC1"
}
}
Search for a Customer/Supplier by Tax Code and/or VAT Number
Using the call
{{webapi_base_url}}/api/v1/{{scope}}/CO/lookup/CustomerSupplierCO?metadata=true&company={{defaultCompany}}&_op=search
it is possible to search for a customer by VAT Number or Tax Code or by Company Name.
{
"filters":
{
"items":
[
{
"comparer": 0,
"propertyName": "CustomerSupplierCO_Tipocf",
"value": "0"
},
{
"operator": 1,
"items":
[
{
"propertyName": "CustomerSupplierCO_GeneralMasterDataCO_Partiva",
"comparer": 0,
"value": "25052733463"
},
{
"operator": 2,
"propertyName": "CustomerSupplierCO_GeneralMasterDataCO_Codfiscale",
"comparer": 30,
"value": "MRARSS13S08H501H"
},
{
"operator": 2,
"propertyName": "CustomerSupplierCO_GeneralMasterDataCO_RagSoAnag",
"comparer": 20,
"value": "ROSSI"
}
]
}
]
},
"pageSize": 5,
"pageNumber": 0
}
Agent Master Data Entry
To insert a new agent, you must use a POST request. Here is an example:
{{webapi_base_url}}/{{api}}/v2/{{scope}}/co/AgentCO?company={{azienda}}
{
"code": "008",
"companyCode": 2.0,
"generalMasterDataCode": 2593,
"extensionData": [],
"additionalData": {},
"pluginData": {}
}
Create a Country
To insert a new country, you must use a POST request. Here is an example:
{{webapi_base_url}}/{{api}}/v2/{{scope}}/co/NationCO?company={{azienda}}
{
"code": 811.0,
"currencyCode": "EURO",
"description": "Nazione Italia Webapi",
"euEntryDate": "1995-01-01T00:00:00",
"ibanLength": 27,
"isIbanUsed": 1,
"iso3166Alpha2": "IT",
"iso3166Alpha3": "ITA",
"iso3166Description": "ITALY",
"iso3166Number": "380",
"isoCode": "IT",
"isSepaStandardUsed": 1,
"nationType": 1.0,
"sianCode": null,
"vatNumberLength": "11"
}
Minimal Insertion of an Item Code
Through the POST call
{{webapi_base_url}}/api/v2/{{scope}}/WH/ItemWH?company={{defaultCompany}}
it is possible to insert a new item code.
Below is an example of inserting an item code with the minimum data:
{ {
"code": "{{ItemCode}}",
"companyCode": {{defaultCompany}},
"description": "Test webapi articolo",
"itemStatusCode": 50,
"vatCode": "22",
"createDate": "2024-05-08T00:00:00",
"updateDate": "2025-10-06T00:00:00",
"barcodes": [],
"currentStatus": {
"statoCorrente": {
"idStato": 4,
"seq": -1,
"indTipoStato": 0
}
},
"descriptions": [
{
"companyCode": 1000.0,
"description": "Test webapi articolo"
}
],
"intrastatData": null,
"packagings": [
{
"capacity": 0.0,
"companyCode": 1000.0,
"packagingCode": "CD",
"packagingPieces": 1.000,
}
],
"stocks": [
{
"companyCode": 1000.0,
"coverIndex": 0.000,
"isAutosaveStocksQuantity": 1,
"maxStock": 100.000,
"minStock": 10.000,
"storageCode": "00",
}
]
}
}
Reading service for Item Barcode
The article barcode reading service allows you to read the barcodes of all articles. For example
POST {{webapi_base_url}}/{{api}}/v2/{{scope}}/WH/ItemBarCodeWH/search?company={{defaultCompany}}
This is the body of Search service:
{
"filters": {
"operator": 0,
"items": [
{
"operator": 0,
"propertyName": "itemcode",
"comparer": 0,
"value": "ARTICOLO3"
}
]
},
"pageSize": 0,
"pageNumber": 0
}
This is the response:
{
"totalCount": 0,
"pageSize": 1,
"pageNumber": 0,
"data": [
{
"barcode": "0000000000079",
"barcodeType": 0.0,
"companyCode": 1000.0,
"hyperMediaId": null,
"isCheckdigitCalculation": 1.0,
"isPrintLabels": 1.0,
"isSendToCashRegisters": 1.0,
"itemCode": "ARTICOLO3",
"itemVariantCode": "",
"managementType": 0.0,
"originType": 1.0,
"piecesPerPackaging": 1.000,
"extensionData": [],
"additionalData": {},
"pluginData": {}
}
],
"extensionData": [],
"additionalData": {},
"pluginData": {}
}
Reading and Searching ItemStatusWH
The ItemStatusWH service allows you to read and search for standard item statuses. For example
{{webapi_base_url}}/{{api}}/v1/{{scope}}/WH/ItemStatusWH/search?company={{defaultCompany}}
This is the body of Search service:
{
"filters": {
"items": [
{
"operator": 1,
"propertyName": "indStato",
"comparer": 0,
"value": 10
}
]
},
"pageSize": 0,
"pageNumber": 0
}
This is the response:
{
"totalCount": 0,
"pageSize": 1,
"pageNumber": 0,
"data": [
{
"descr": "In progettazione",
"indStato": 10.0,
"extensionData": [],
"additionalData": {},
"pluginData": {}
}
],
"extensionData": [],
"additionalData": {},
"pluginData": {}
}
Management of parametric states on customers-suppliers, items and documents
The StateManagementService service allows user to view the Current State of an object, based on the identifying guid, and allows user to change the current state to one of its available states.
The Current State is managed for the following entities:
- CustomerSupplierMG (GET only)
- CustomerSupplierCO
- DocumentoCorpoMG
- DocumentoTestataMG
- ItemWH
User can view and/or modify the Current State of an object if a predefined Flow has been defined for the entity in question and based on the permissions related to the user being used.
Through a simple GET call, user can view the Current State and the Available States for a specific user in the response. For example, if user wants to check the current state of the item code SW6 for the admin user, the GET call should be structured as follows:
GET {{webapi_base_url}}/{{api}}/v1/{{scope}}/WH/ItemWH/SW6?company={{defaultCompany}}&user=admin
and the response will show the state of the item code under consideration and the available states for the admin user.
"statoAttualeCO": {
"statoCorrente": {
"idStato": 4,
"seq": -1,
"indTipoStato": 0,
"extensionData": [],
"additionalData": {}
},
"statiDisponibili": [
{
"idStato": 3,
"seq": 3,
"indTipoStato": 0,
"extensionData": [],
"additionalData": {}
},
{
"idStato": 4,
"seq": 4,
"indTipoStato": 0,
"extensionData": [],
"additionalData": {}
},
{
"idStato": 5,
"seq": 5,
"indTipoStato": 0,
"extensionData": [],
"additionalData": {}
},
{
"idStato": 6,
"seq": 6,
"indTipoStato": 0,
"extensionData": [],
"additionalData": {}
}
}
If user runs the same GET call but specifies another user (who does not have the same permissions as the 'admin' user mentioned above), the response will always show the same Current State but will only show the available states for the other user.
Through the PUT or PATCH call, user can modify the value of the Current State of the entity under consideration, so for example, considering the item code SW6, the PATCH call should be structured as follows:
PATCH {{webapi_base_url}}/{{api}}/v1/{{scope}}/WH/ItemWH/SW6?company={{defaultCompany}}&user=admin
and in the body, user must indicate a new stateId among those available:
{
"statoAttualeCO": {
"statoCorrente": {
"idStato": 5,
"seq":5,
"indTipoStato": 0,
"extensionData": [],
"additionalData": {}
}
}
}
Through the StateManagementService service and through the related GUID, it is possible to view the currentState (which corresponds to the CurrentState) existing for the object under consideration, and as well as the availableStates (which corresponds to the list of available States). For example, always considering the item code 'SW6' for the admin user, a GET call is made, specifying the corresponding GUID of the aforementioned item code:
GET {{webapi_base_url}}/{{api}}/v1/{{scope}}/CO/StateManagementService/{000-000-000-000}?company={{defaultCompany}}&user=admin
And the response will be as follows:
{
"currentState": {
"idStato": 4,
"description": "In uso",
"seq": -1,
"indTipoStato": 0,
"extensionData": [],
"additionalData": {}
},
"availableStates": [
{
"idStato": 3,
"description": "Rilasciato",
"seq": 3,
"indTipoStato": 0,
"extensionData": [],
"additionalData": {}
},
{
"idStato": 4,
"description": "In uso",
"seq": 4,
"indTipoStato": 0,
"extensionData": [],
"additionalData": {}
},
{
"idStato": 5,
"description": "In esaurimento",
"seq": 5,
"indTipoStato": 0,
"extensionData": [],
"additionalData": {}
},
{
"idStato": 6,
"description": "Dismesso",
"seq": 6,
"indTipoStato": 0,
"extensionData": [],
"additionalData": {}
}
]
}
Or
For example, if you want to check the CurrentState of a document, you make a GET call (as shown), specifying the corresponding GUID of the DocumentHeader:
GET {{webapi_base_url}}/{{api}}/v1/{{scope}}/CO/StateManagementService/{{guidTestataDocumento}}?company={{defaultCompany}}&user=admin
And the response will show the CurrentState (or currentState) of the document and any AvailableStates (or availableStates), so it will be as follows:
{
"currentState": {
"idStato": 41,
"description": "Confermato",
"seq": -1,
"indTipoStato": 0,
"extensionData": [],
"additionalData": {}
},
"availableStates": [
{
"idStato": 40,
"description": "Acquisito",
"seq": 1,
"indTipoStato": 0,
"extensionData": [],
"additionalData": {}
},
{
"idStato": 41,
"description": "Confermato",
"seq": 2,
"indTipoStato": 0,
"extensionData": [],
"additionalData": {}
},
{
"idStato": 42,
"description": "Bloccato",
"seq": 3,
"indTipoStato": 0,
"extensionData": [],
"additionalData": {}
},
{
"idStato": 43,
"description": "In spedizione",
"seq": 4,
"indTipoStato": 0,
"extensionData": [],
"additionalData": {}
},
{
"idStato": 44,
"description": "Evaso",
"seq": 5,
"indTipoStato": 0,
"extensionData": [],
"additionalData": {}
}
]
}
Or if you want to check the CurrentState of a row within the document under consideration, with a simple GET on the document, you retrieve the corresponding GUID identifying the said row and then execute the following GET call for the StateManagementCO service:
GET {{webapi_base_url}}/{{api}}/v1/{{scope}}/CO/StateManagementService/{{guidRigaDocumento}}?company={{defaultCompany}}&user=admin
And the response will show the CurrentState (or currentState) of the document row and any AvailableStates (or availableStates), so it will be as follows:
{
"currentState": {
"idStato": 46,
"description": "In evasione",
"seq": -1,
"indTipoStato": 0,
"extensionData": [],
"additionalData": {}
},
"availableStates": [
{
"idStato": 45,
"description": "Da evadere",
"seq": 1,
"indTipoStato": 0,
"extensionData": [],
"additionalData": {}
},
{
"idStato": 46,
"description": "In evasione",
"seq": 2,
"indTipoStato": 0,
"extensionData": [],
"additionalData": {}
},
{
"idStato": 47,
"description": "Evasa",
"seq": 3,
"indTipoStato": 0,
"extensionData": [],
"additionalData": {}
},
{
"idStato": 48,
"description": "Bloccata",
"seq": 4,
"indTipoStato": 0,
"extensionData": [],
"additionalData": {}
},
{
"idStato": 49,
"description": "Annullata",
"seq": 5,
"indTipoStato": 0,
"extensionData": [],
"additionalData": {}
}
]
}
Through the StateManagementService and the setstate action, it is also possible to advance the existing 'currentState' for an object, always using the relevant GUID, by specifying a new 'idState' from those available for the user being used. In this case, the following POST call is executed:
POST {{webapi_base_url}}/{{api}}/v1/{{scope}}/CO/StateManagementService/setstate?company={{defaultCompany}}&user=admin
and in the body, you specify the GUID of the object in question and the new idState, specifying it in the "newState" field:
{
"guidObject": "{000-000-000-000}",
"newState": 5,
"entityCodeForDefault": null
}
For example, considering a specific customer in the 'Codified' state (idState=7), after the appropriate administrative checks, you want to advance the customer's state from 'Codified' to 'In Use' (idState=8). To do this, you execute the POST call, specifying the customer's GUID in the body:
POST {{webapi_base_url}}/{{api}}/v1/{{scope}}/CO/StateManagementService/setstate?company={{defaultCompany}}&user=admin
And in the body, you specify the GUID of the object in question (in this case, the Customer) and the new idState, specifying it in the "newState" field:
{
"guidObject": "{{guidCliente}}",
"newState": 8,
"entityCodeForDefault": null
}
User can also verify the case where a predefined Flow has not been specified, so when creating an item code, for example, the code 'AW1', the CurrentStateCO is NULL. Later, from the Interface, user indicates a flow as 'Default' for the Items entity. At this point, through the 'setstate' action, user can set the value of the 'Default' state belonging to the corresponding 'Default Flow' for the Items entity.
So user runs the same POST call, setting the "newState" parameter to null and "entityCodeForDefault": 6, specifying the guid of the object under consideration (therefore the guid of the item code under consideration AW1)
{
"guidObject": "{000-000-000-000}",
"newState": null,
"entityCodeForDefault": 6
}
The response will show the currentState and the availableStates, as shown below:
{
"currentState": {
"idStato": 10002,
"description": "item inserted",
"seq": -1,
"indTipoStato": 0,
"extensionData": [],
"additionalData": {}
},
"availableStates": [
{
"idStato": 10002,
"description": "item inserted",
"seq": 1,
"indTipoStato": 0,
"extensionData": [],
"additionalData": {}
},
{
"idStato": 10003,
"description": "item confirmed",
"seq": 2,
"indTipoStato": 0,
"extensionData": [],
"additionalData": {}
}
]
}
Through the StateManagementService and the history action, user can also view the various state advancements of the object under consideration, always through the corresponding guid. User performs a GET call structured as follows:
GET {{webapi_base_url}}/{{api}}/v1/{{scope}}/CO/StateManagementService/history/{000-000-000-000}?company={{defaultCompany}}&user=admin
and the response will show the "currentState" and the "statusOperationHistory" with various information:
{
"currentState": {
"idStato": 10003,
"description": "item confirmed",
"seq": -1,
"indTipoStato": 0,
"extensionData": [],
"additionalData": {}
},
"statusOperationHistory": [
{
"idHistory": 135,
"idStatus": 10002,
"validityDate": "2025-03-10T00:00:00",
"updateDate": "2025-03-10T15:00:54.713",
"historyAuto": 0,
"statusDescription": "item inserted",
"flowDescription": "Test Flow",
"userDescription": "Admin user",
"historyDelete": 1
},
{
"idHistory": 136,
"idStatus": 10003,
"validityDate": "2025-03-21T00:00:00",
"updateDate": "2025-03-21T15:03:39.033",
"historyAuto": 0,
"statusDescription": "item confirmed",
"flowDescription": "Test Flow",
"userDescription": "Admin user",
"historyDelete": 0
}
],
}
Inserting a Brand to Associate with an Item
Through the new BrandWH service, you can create/insert a Brand that can later be associated with an item. To insert a new Brand, you need to use a POST request. Here’s an example:
POST {{webapi_base_url}}/api/v1/{{scope}}/WH/BrandWH?company={{defaultCompany}}&user=admin
With the following minimal body:
{
"codMarca": "{{codMarca}}",
"descrmarca": "Marca di test"
}
The response will be:
{
"codMarca": "NikeTest",
"descrmarca": "Marca di test",
"dittaCg18": 1000.0,
"idmediaCg99": null,
"idprov": 8,
"extensionData": [],
"additionalData": {},
"pluginData": {}
}
BatchInventoryService for Batch Inventory Inquiry
The BatchInventoryService, with its corresponding batchinventory action, allows you to perform a batch inventory inquiry for warehouse items managed by lot, replicating the behavior of the "Batch Inventory Inquiry and Print" procedure from the interface.
The input parameters also support filtering, sorting, and pagination conditions.
For example, to check the inventory status of the item code LOT_KIT (which is lot-managed) in the main warehouse, considering the "Progressives to be processed" equal to the "Real-time" parameter, the following POST request is made:
{{webapi_base_url}}/{{api}}/v1/{{scope}}/WH/BatchInventoryService/batchinventory?company={{defaultCompany}}&user=admin
In the request body, under the searchParameters parameter, the item code LOT_KIT and the main warehouse code "00" are defined as shown below:
{
"entriesCombination": 1,
"progressiveType": 1,
"searchParameters": {
"filterProperties": [
{
"propertyName": "ItemCode",
"fromValue": "LOT_KIT",
"toValue": "LOT_KIT"
},
{
"propertyName": "StorageCode",
"fromValue": "00",
"toValue": "00"
}
],
"pageSize": 0,
"pageNumber": 0
}
}
The response returns inventory values by item code and lot code. In our example, the rows section is populated with all the lot codes involved (shown under the lotCode parameter) for the item code LOT_KIT, as illustrated below:
{
"totalRowsFound": 2,
"totalRowsShowed": 2,
"pageNumber": 0,
"rows": [
{
"itemCode": "LOT_KIT ",
"itemVariantCode": " ",
"itemDescription": "articolo che gestisce i lotti",
"storageCode": "00",
"lotCode": "L1 ",
"lotDescription": "lotto1",
"dueDate": null,
"serialNumber": null,
"palletsCode": null,
"projectCode": null,
"locationCode": null,
"packagingCode": null,
"materialsDyeingCode": null,
"referenceNodeCode": null,
"totalLoadQuantity1": 24.000,
"totalUnloadQuantity1": 9.000,
"totalLoadQuantity2": 0.000,
"totalUnloadQuantity2": 0.000,
"initialStockQuantity1": 0.000,
"currentStockQuantity1": 15.000,
"actualStockQuantity1": 15.000,
"fiscalStockQuantity1": 15.000,
"prodCommQuantity1": 0.000,
"initialStockQuantity2": 0.000,
"currentStockQuantity2": 0.000,
"actualStockQuantity2": 0.000,
"fiscalStockQuantity2": 0.000,
"prodCommQuantity2": 0.000,
"freeUnload2Quantity2": 0.000,
"averageCostQuantity1": 546.670000,
"lastCost": 310.000000
},
{
"itemCode": "LOT_KIT ",
"itemVariantCode": " ",
"itemDescription": "articolo che gestisce i lotti",
"storageCode": "00",
"lotCode": "L2 ",
"lotDescription": "lotto2",
"dueDate": null,
"serialNumber": null,
"palletsCode": null,
"projectCode": null,
"locationCode": null,
"packagingCode": null,
"materialsDyeingCode": null,
"referenceNodeCode": null,
"totalLoadQuantity1": 16.000,
"totalUnloadQuantity1": 6.000,
"totalLoadQuantity2": 0.000,
"totalUnloadQuantity2": 0.000,
"initialStockQuantity1": 0.000,
"currentStockQuantity1": 10.000,
"actualStockQuantity1": 10.000,
"fiscalStockQuantity1": 10.000,
"prodCommQuantity1": 0.000,
"initialStockQuantity2": 0.000,
"currentStockQuantity2": 0.000,
"actualStockQuantity2": 0.000,
"fiscalStockQuantity2": 0.000,
"prodCommQuantity2": 0.000,
"freeUnload2Quantity2": 0.000,
"averageCostQuantity1": 546.670000,
"lastCost": 310.000000
},
]
}
NOTE: If ProgressiveType = 2 is specified, the year parameter becomes mandatory.
Documents
Document insertion with minimal data
The "Document" resource can be used to insert/delete/modify a document in TSE. The resource can be used to insert any type of document, simply by changing the document code in the call.
In order for the information sent to the WebAPI via the corresponding DTO to be correctly received and stored, it is essential that the document code wizard used also handles it properly on the user interface.
Therefore, during the solution design phase, it is necessary to always perform a double check: verify that a document manually entered through the user interface, with the same information sent via WebAPI, is correctly registered and managed by the system.
The insertion of a document can occur synchronously with the POST method.
Please note that to insert a document, it is not necessary to populate all the properties of the complex DTO that represents it. Here is an example of a minimal document insertion with the essential header information and a line of type “item,” including item code and quantity.
Post {{webapi_base_url}}/{{api}}/v2/{{scope}}/MG/DocumentMG?company={{defaultCompany}}
with the body:
{
{
"callOptions": {
"forceStampExpensesToZero": false,
"forceCollectionExpensesToZero": false,
"lockInsertExistingDocument": false,
"excludeLoadingMultipleAgents": true,
"excludeHeaderVat": false,
"disableLetterOfIntent": true,
"excludeCSExpensesFixedTexts": false,
"disableExistingItemCheck": false
},
"companyCode": 1000,
"currencyCode": "EURO",
"customerSupplierCode": 1.0,
"customerSupplierType": 0.0,
"documentCode": "CLI-ORDINE",
"documentDate": "2025-10-15T00:00:00",
"documentSubtype": 1.0,
"documentType": 21.0,
"documentTypeNumbering": 39.0,
"registrationDate": "2025-10-15T00:00:00",
"storageCode": "00",
"vatCode": "317",
"sectionalCode": "00",
"officeCode": "YYY",
"agents": [],
"rows": [
{
"callOptions": {
"forcePriceDiscount": false
},
"companyCode": 1000,
"description": "Descrizione articolo",
"itemCode": "ART001",
"qty1": 1.000,
"qty2": null,
"rowProgressive": 2.0,
"rowType": 0
}
],
"extensionData": [],
"additionalData": {},
"pluginData": {}
}
}
Some Notes/Comparisons on Version V2
"ditta" or "dittaCg18" (the company working code): Renamed to companyCode property in DocumentHeaderV2MG.
"companyDocumentMasterData": This property has been removed and is now handled through the "documentCode" field. By setting this field, the system automatically recognizes whether the document code is standard or customized.
"customerSupplierMG": The property of type customerSupplierMGDTO has been removed. The customer or supplier to whom the document is assigned is now managed through the fields customerSupplierCode and customerSupplierType. For example, to assign the document to the customer with code 123, you need to set: "customerSupplierCode": 123 and "customerSupplierType": 0.0.
{
"customerSupplierCode": 123,
"customerSupplierType": 0.0,
}
Please note that customerSupplierCode refers to the customer code (or the supplier code for supplier-type documents) and not the ID stored in the CG44_CLIFOR table. Finally, remember that if the document code requires a customer or supplier, you must define the customerSupplierType indicator with the possible values from the CG44_TIPOCF field of the CG44_CLIFOR table, which are:
0 for customers 1 for suppliers
"sectionalCode": the section of the document numbering (e.g., "sezdoc": "00")
"storageCode": the "storageCode" field represents the warehouse to be moved. For example, working on company 100, to order goods in warehouse "00", it is necessary to set the storageWH property as follows:
{
"storageCode": "00",
}
"rows": the array of rows to be inserted into the document; it is an array of objects of type DocumentRowV2MGDTO. The types of rows currently supported in the document body are as follows:
- Item (rowType = 0)
- Manual Item (rowType = 1)
- Descriptive (rowType = 2)
- Expense (rowType = 4)
- Fixed Text (rowType = 6)
- Node (rowType = 15)
- Activity (rowType = 16)
- Project Expense (rowType = 17)
Other types usable from the direct document issuance interface are not supported.
Depending on the type of line to be inserted in the document, a different "rowType" must be specified, as described above. For each document line, at least the line number, code, and quantity must be indicated.
- For item lines, at least the line number, item code, item description, and quantity must be indicated. The rowType property takes the default value of 0 if not set.
{
"rowProgressive": 1.0,
"itemCode": "ART001",
"description": "Descrizione articolo ART001",
"qty1": 1.000
}
Note: If item lines are inserted and an item code provides for the automatic explosion of additional lines, the "rowProgressive" is automatically recalculated by the procedure.
- For miscellaneous expense lines, at least rowType, rowProgressive, quantity (normally unitary), and expense code must be indicated, as in the following example:
{
{
"rowProgressive": 4,
"rowType": 4.0,
"qta1": 1.000,
"variousExpenseCode": "ST",
}
}
Price retrieval when inserting lines If the prices and discounts of warehouse items inserted in the document body are passed with a value of zero, the business logic values them based on the price retrieval configuration set on the document code parameterization used.
If the price and discounts passed in the DTO are different from zero, the values proposed by the price retrieval logic from the configuration will be overwritten with the values passed in the DTO.
Price retrieval when inserting lines If the prices and discounts of warehouse items inserted in the document body are passed with a value of zero, the business logic values them based on the price retrieval configuration set on the document code parameterization used.
If the price and discounts passed in the DTO are different from zero, the values proposed by the price retrieval logic from the configuration will be overwritten with the values passed in the DTO.
Regarding Document scenarios, some examples are made available directly within the POST (Create) call of the IntegrationMG\DocumentMG module in the swagger:

Using the Try it out feature, it will be possible to automatically execute the call, replacing the placeholders indicated in the examples with the appropriate data.
Available Document examples on Swagger:
Default (complete): shows the complete call body; Min required: Minimal mandatory header information; Order: example of an order-type document body; Delivery Note: example of a delivery note-type document body; Invoice: example of an invoice-type document body; Transfer warehouses: example of a warehouse transfer-type document body.
callOptions Property
The callOptions property allows grouping all call options/parameters that are not actual fields of the entity.
Currently, the following options are available:
forceStampDutyToZero(default false): set to true if you want to force the value = 0 of the stamp duty expenses flag;forceCollectionFeesToZero(default false): set to true if you want to force the value = 0 of the collection expenses flag;excludeLoadingMultipleAgents(default false): set to true to exclude the loading of multiple agents in the header;excludeHeaderVat(default false): set to true to force the VAT code of the document header to Null;lockInsertExistingDocument(default false): set to true to block the insertion of an already existing document;disableLetterOfIntent(default false): set to true to disable letters of intent;excludeCSExpensesFixedTexts(default false): set to true to exclude the proposal of default expense and fixed text lines of the Customer.disableExistingItemCheck(default false): Set to true to disable the check for item existence.enableAdditionalValidations(default false): Set to true to enable the mandatory check based on the parameters defined in the Batch Parameters Console.
Get Active Entities from Document Wizard
Service that displays all active modules associated with a document based on its configuration through the Document Wizard. Example:
GET {{webapi_base_url}}/{{api}}/v1/{{scope}}/MG/CompanyDocumentMasterDataMG/CLI-ORDINE/enablementwizard?company={{defaultCompany}}
The service returns the following Json:
{
"document": "CLI-ORDINE ",
"documentCustom": 1.0,
"description": "Ordine da clienti",
"isDocumentHeader": true,
"isDocumentHeaderReference": true,
"isDocumentTotal": true,
"isDocumentHeaderShipmentData": true,
"isDocumentHeaderCustomizedAttribute": true,
"isDocumentHeaderOrder": true,
"isDocumentHeaderStandardAttribute": true,
"isDocumentHeaderCommission": true,
"isDocumentHeaderAccrual": true,
"isDocumentHeaderProject": true,
"isDocumentHeaderAgent": true,
"isDocumentRow": true,
"isDocumentRowOrder": true,
"isDocumentRowCommission": true,
"isDocumentRowReference": true,
"isDocumentRowCustomizedAttribute": true,
"isDocumentRowStandardAttribute": true,
"isDocumentRowPackaging": false,
"isDocumentRowProject": true,
"isDocumentRowAccrual": true,
"isDocumentRowLot": false,
"isDocumentRowAnalyticalCorrelation": true,
"isDocumentRowIntra": false
}
Management of the Preferred Agent
It is possible to manage the preferred agent when saving a customer (CustomerSupplierCO). Any agent associated with the customer is inserted into the multiple agents as the preferred agent. It is also possible to define additional multiple agents for the customer.
When inserting a document, the multiple agents stored in the customer registry are retrieved.
However, if different agents are specified in DocumentoTestataAgentiMG property during document insertion, these will replace those retrieved from the customer registry.
Through the callOptions property, it is possible to include or exclude multiple agents.
EsclusioneAgentiMultipli = false (with callOptions property or parameter=0 on version 8)
- If the
DocumentoTestataAgentiMGproperty is not set in the DTO, the system will populate theDO29_DOCTESAGENTItable with the agents linked to the customer and retrieved using the usual logic employed by the management software when inserting the document from the interface. - If the
DocumentoTestataAgentiMGproperty is set in the DTO, the system will populate theDO29_DOCTESAGENTItable with the agents mentioned in the previous point and with the agents passed inDocumentoTestataAgentiMG(the two sets of agents are merged).
EsclusioneAgentiMultipli = true (with callOptions property or parameter=1 on version 8)
- The system will populate the
DO29_DOCTESAGENTItable only with any agents passed inDocumentoTestataAgentiMG, ignoring those that would be proposed by the customer configuration.
Price Search from Priority Price Lists
Retrieving Prices When Inserting Rows from Priority Price Lists: PricePriorityLI Service The service allows you to perform a price search from priority price lists through the PricePriorityLI service.
The attached example shows the price of the priority price lists processed based on the Priority Table defined on TSE, used to generate the PricePriorityLI, and displays it in the Result ("RowElaboratePriceList") if the parameter "ResultElaboratePriceList" is set to true.
Parameters
- Price Type (typeSalePurchaseProd):
Decimal(DO11_TIPOCF_CG44/2)
0 = Sales (default)
1 = Purchases
2 = Production - Item Code (CodartMg66):
String(DO30_CODART_MG66) — mandatory - Customer/Supplier Code:
Decimal(DO11_CLIFOR_CG44) - Registration Date:
Datetime(DateElab) — mandatory - Quantity 1 (of row) (qty1):
Decimal(DO30_QTA1) - Price List Number (numPriceList):
Decimal(DO11_LISTMAG) - Warehouse Code (codDepMg58):
String(DO30_CODDEP_MG58) - Enable display of processed price list (resultElaboratePriceList): if set =
true
Example
{
"typeSalePurchaseProd": 0,
"codArtMg66": "ART_LI",
"cliforCg44": 1,
"dateElab": "2024-06-14 00:00:00",
"qty1": 0,
"numPriceList": 1,
"codDepMg58": "00",
"resultElaboratePriceList": true
}
Price Search from Parametric Price Lists
Retrieving prices when inserting rows from parametric price lists: PriceParametricLI service The PriceParametricLI service allows you to determine the price based on parametric price lists starting from the priority code defined in the Priority Table on TSE.
This service requires the "PriceParametricParameters" and calls the stored procedure SPLP_QUOTPROBELIST to retrieve the current price with any discounts in "PriceParametricLI".
A parameter is also provided to request the detail of the outcome of the parametric price list processing, which allows you to understand how the price was formed based on the priority table and the providers used.
WARNING!: Currently, the stored procedure also manages commercial conditions and commissions for document footer, which are not handled in this initial phase (the fixed parameter @RIGA_PIEDE=0 is passed to the stored procedure).
Parameters
- ResultElab bool (default false) Parameter to activate the outcome of the parametric price list processing. If activated, it is necessary to pass to the stored procedure the name of a temporary table where all the price rows found to generate the final price are stored.
- dataReg - Registration date --- mandatory
- CodTabPriority int64 (ID_TABPRIORITA) --- mandatory Through the code, the IdTabPriority to be passed to the stored procedure is derived.
- tipocfCg44 - Customer/Supplier Type Decimal (DO11_TIPOCF_CG44) WARNING: Document type conversion: customer= 0 --> becomes 1 and supplier=1 becomes 2 to be passed to the stored procedure.
- cliforCg44 - Customer/Supplier Code Decimal (DO11_CLIFOR_CG44) All customer/supplier fields are read automatically.
- codartMg66 - String (DO30_CODART_MG66) --- mandatory
- documentData - Document date Datetime (DATADOC) If not set, it is valued with the registration date
Example
{
"resultElab": false,
"dataReg": "2023-06-22T13:34:35.125Z",
"CodTabPriority": "TVEN",
"tipocfCg44": 0,
"cliforCg44": 2,
"codartMg66": "2",