Inserts a document or updates an existing one. | Uses your API Key and applies a mvRecordAction
value on an mvDocument object. We can insert the mvDocument object we specified using
"Insert" as our mvRecordAction. We can update a current document using "Update", we can
insert if a document it doesn't already exist, update a document if it does using "InsertOrUpdate" and we
can insert new fields or update non-empty fields of the document using "InsertOrUpdateNonEmptyFields".
Optionally, you can use mvInsertUpdateDeleteSourceApplication when an external application ( eg Magento )
is the one that triggers the DocumentUpdate call. Only the DocumentDescription can be changed during the update.
AutoInsertBatchNumbersToProductRows: this field is used to
automatically attach batch numbers to the material that is being allocated, depending on the order that you have selected (e.g. if you want
to attach first the batch numbers that have the closest expiry date, give this field the value ByExpiryDate).
A. Inserts a Document of type Goods Inbound (can be seen from the document type id = -2 field)
Value: {
"mvDocument": {
"DocumentTypeId": -2,
"DocumentSupplierClientID": 5357,
"DocumentDetails": [
{
"DocumentRowProductSKU": "serialized",
"DocumentRowProductDescription": "serialized",
"DocumentRowQuantity": 2,
"DocumentRowUnitPriceWithoutTaxOrDiscount": 0,
"DocumentRowTaxID": 0,
"DocumentTotalTaxAmount": 0,
"DocumentRowDiscountID": 0,
"DocumentRowTotalDiscountAmount": 0,
"DocumentRowTotalAmount": 0,
"DocumentRowRemarks": ""
}
],
"DocumentStatus": "Pending"
},
"mvRecordAction": "Insert"
}
Response: {
"mvDocument": {
"DocumentId": 49431,
"DocumentTypeId": -2,
"DocumentTypeAbbreviation": "",
"DocumentTypeDescription": "",
"DocumentNo": "---",
"DocumentDate": "/Date(1531774800000+0300)/",
"DocumentCustomOrderDate1": "/Date(-62135596800000-0000)/",
"DocumentCustomOrderDate2": "/Date(-62135596800000-0000)/",
"DocumentCurrencyCode": "USD",
"DocumentSupplierClientID": 5357,
"DocumentBillingAddress": "",
"DocumentAddress": "",
"DocumentContactPerson": "",
"DocumentInventoryLocationID": 0,
"DocumentCustomFlag1": false,
"DocumentCustomFlag2": false,
"DocumentCustomFlag3": false,
"DocumentCustomFlag4": false,
"DocumentCustomFlag5": false,
"DocumentCustomFlag6": false,
"DocumentCustomFlag7": false,
"DocumentCustomFlag8": false,
"DocumentCustomFlag9": false,
"DocumentCustomFlag10": false,
"DocumentShippingProviderID": 0,
"DocumentTrackingID": "0",
"DocumentComments": "",
"DocumentPaymentTermsEnumeration": "",
"DocumentTags": "",
"DocumentPaymentTermsEnumeration": "None",
"DocumentParentDocId": 0,
"DocumentTotalQuantity": 2,
"DocumentAmountSubtotalWithoutTaxAndDiscount": 0,
"DocumentAmountShipping": 0,
"DocumentAmountTotalDiscount": 0,
"DocumentAmountTotalTax": 0,
"DocumentAmountGrandTotal": 0,
"DocumentDetails": [
{
"DocumentRowDetailID": 76504,
"DocumentRowProductID": 60424,
"DocumentRowProductSKU": "serialized",
"DocumentRowProductDescription": "serialized",
"DocumentRowQuantity": 2,
"DocumentRowUnitPriceWithoutTaxOrDiscount": 0,
"DocumentRowTaxID": 0,
"DocumentTotalTaxAmount": 0,
"DocumentRowDiscountID": 0,
"DocumentRowTotalDiscountAmount": 0,
"DocumentRowTotalAmount": 0,
"DocumentRowSerialNumbers": [],
"DocumentRowBatchNumbers": [],
"DocumentRowRemarks": ""
}
],
"DocumentStatus": "Pending",
"DocumentCreationDate": "/Date(-62135596800000-0000)/",
"DocumentLastUpdatedDate": "/Date(-62135596800000-0000)/"
},
"ResponseStatus": {
"ErrorCode": "0"
},
"entityID": 49431
}
B.
Try adding a Document referring to a non existent product
Value: {
"mvDocument": {
"DocumentTypeId": -2,
"DocumentSupplierClientID": 5357,
"DocumentDetails": [
{
"DocumentRowProductSKU": "Bananas",
"DocumentRowProductDescription": "serialized",
"DocumentRowQuantity": 2,
"DocumentRowUnitPriceWithoutTaxOrDiscount": 0,
"DocumentRowTaxID": 0,
"DocumentTotalTaxAmount": 0,
"DocumentRowDiscountID": 0,
"DocumentRowTotalDiscountAmount": 0,
"DocumentRowTotalAmount": 0,
"DocumentRowRemarks": ""
}
],
"DocumentStatus": "Pending"
},
"mvRecordAction": "Insert"
}
Response: {
"ResponseStatus": {
"ErrorCode": "500",
"Message": "The product with DocumentRowProductSKU [Bananas] does not exist. Document Insert Failed"
},
"entityID": 0,
"InternalErrorCode": ""
}
|