Megaventory API v2017a

<back to all web services

DocumentsUpdate

The following routes are available for this service:
POST/Document/DocumentsUpdateInserts/Updates multiple Documents.Uses your API Key and applies a mvRecordAction value on an mvDocument object. We can insert a new mvDocument using "Insert" as our mvRecordAction. DocumentTypeId, DocumentSupplierClientID, DocumentRowProductSKU, DocumentRowQuantity, DocumentStatus fields are mandatory fields.

Examples:



A.

Inserts a Document of type Goods Inbound (can be seen from the document type id = -2 field) and an Internal Transaction document (can be seen from the document type id = -1 field).

Value:

{
   "Documents": [
    {
      "mvDocument": {
        "DocumentTypeId": -2,
        "DocumentSupplierClientID": 2024,
        "DocumentInventoryLocationID": 1011, 
        "DocumentDetails": [
          {
            "DocumentRowProductSKU": "Sugar",
            "DocumentRowQuantity": 2
          }
        ],
        "DocumentStatus": "Verified"
      },
      "mvRecordAction": "Insert"
    },
    {
      "mvDocument": {
        "DocumentTypeId": -1,
        "DocumentSupplierClientID": 0,
        "DocumentInventoryLocationID": 1011,
        "DocumentDetails": [
          {
            "DocumentRowProductSKU": "Sugar",
            "DocumentRowQuantity": 2
          }
        ],
        "DocumentStatus": "Verified"
      },
      "mvRecordAction": "Insert"
    }
  ]
}


Response:

{
   "DocumentsResponses": [
    {
      "mvDocument": {
        "DocumentId": 23759,
        "DocumentTypeId": -2,
        "DocumentTypeAbbreviation": "R-CONS",
        "DocumentTypeDescription": "Receive On Consignment",
        "DocumentNo": "1",
        "DocumentReferenceNo": "",
        "DocumentReferenceApplication": "",
        "DocumentDate": "/Date(1700656232180+0200)/",
        "DocumentCustomOrderDate1": "/Date(-62135596800000-0000)/",
        "DocumentCustomOrderDate2": "/Date(-62135596800000-0000)/",
        "DocumentCurrencyCode": "EUR",
        "DocumentSupplierClientID": 2024,
        "DocumentSupplierClientName": "Giovanni",
        "DocumentBillingAddress": "",
        "DocumentAddress": "",
        "DocumentAddresses": [
          {
            "AddressType": "Billing",
            "AddressLine1": "",
            "AddressLine2": "",
            "AddressLine3": "",
            "TaxIdNumber": "",
            "Organization": "",
            "City": "",
            "State": "",
            "Country": "NONE",
            "CountryName": "",
            "Longitude": "",
            "Latitude": "",
            "ZipCode": ""
          },
          {
            "AddressType": "Shipping1",
            "AddressLine1": "",
            "AddressLine2": "",
            "AddressLine3": "",
            "TaxIdNumber": "",
            "Organization": "",
            "City": "",
            "State": "",
            "Country": "NONE",
            "CountryName": "",
            "Longitude": "",
            "Latitude": "",
            "ZipCode": ""
          }
        ],
        "DocumentContactPerson": "",
        "DocumentInventoryLocationID": 1011,
        "DocumentCustomFlag1": false,
        "DocumentCustomFlag6": false,
        "DocumentCustomFlag2": false,
        "DocumentCustomFlag7": false,
        "DocumentCustomFlag3": false,
        "DocumentCustomFlag8": false,
        "DocumentCustomFlag4": false,
        "DocumentCustomFlag9": false,
        "DocumentCustomFlag5": false,
        "DocumentCustomFlag10": false,
        "DocumentShippingProviderID": 0,
        "DocumentTrackingID": "",
        "DocumentComments": "",
        "DocumentTags": "",
        "DocumentPaymentTermsEnumeration": "None",
        "DocumentPaymentMethod": "None",
        "DocumentParentDocId": 0,
        "DocumentHandlingDocId": 0,
        "DocumentTotalQuantity": 2,
        "DocumentAmountSubtotalWithoutTaxAndDiscount": 0,
        "DocumentAmountShipping": 0,
        "DocumentAmountTotalDiscount": 0,
        "DocumentAmountTotalTax": 0,
        "DocumentAmountGrandTotal": 0,
        "DocumentDetails": [
          {
            "DocumentRowDetailID": 26514,
            "DocumentRowProductID": 6177,
            "DocumentRowProductSKU": "Sugar",
            "DocumentRowProductDescription": "For Coffee",
            "DocumentRowQuantity": 2,
            "DocumentRowUnitPriceWithoutTaxOrDiscount": 0,
            "DocumentRowTaxID": 0,
            "DocumentTotalTaxAmount": 0,
            "DocumentRowDiscountID": 0,
            "DocumentRowTotalDiscountAmount": 0,
            "DocumentRowTotalAmount": 0,
            "DocumentRowSerialNumbers": [],
            "DocumentRowBatchNumbers": [],
            "DocumentRowRemarks": ""
          }
        ],
        "DocumentStatus": "Verified",
        "chkReOpenOrCloseRelatedDocs": false,
        "DocumentCreationDate": "/Date(1700656231787+0200)/",
        "DocumentLastUpdatedDate": "/Date(1700656232141+0200)/"
      },
      "ResponseStatus": {
        "ErrorCode": "0"
      },
      "entityID": 23759
    },
    {
      "mvDocument": {
        "DocumentId": 23760,
        "DocumentTypeId": -1,
        "DocumentTypeAbbreviation": "INTRANS",
        "DocumentTypeDescription": "Internal Transfer",
        "DocumentNo": "1",
        "DocumentReferenceNo": "",
        "DocumentReferenceApplication": "",
        "DocumentDate": "/Date(1700656236583+0200)/",
        "DocumentCustomOrderDate1": "/Date(-62135596800000-0000)/",
        "DocumentCustomOrderDate2": "/Date(-62135596800000-0000)/",
        "DocumentCurrencyCode": "EUR",
        "DocumentSupplierClientID": 0,
        "DocumentSupplierClientName": "",
        "DocumentBillingAddress": "",
        "DocumentAddress": "",
        "DocumentAddresses": [
          {
            "AddressType": "Billing",
            "AddressLine1": "",
            "AddressLine2": "",
            "AddressLine3": "",
            "TaxIdNumber": "",
            "Organization": "",
            "City": "",
            "State": "",
            "Country": "NONE",
            "CountryName": "",
            "Longitude": "",
            "Latitude": "",
            "ZipCode": ""
          },
          {
            "AddressType": "Shipping1",
            "AddressLine1": "",
            "AddressLine2": "",
            "AddressLine3": "",
            "TaxIdNumber": "",
            "Organization": "",
            "City": "",
            "State": "",
            "Country": "NONE",
            "CountryName": "",
            "Longitude": "",
            "Latitude": "",
            "ZipCode": ""
          }
        ],
        "DocumentContactPerson": "",
        "DocumentInventoryLocationID": 1011,
        "DocumentCustomFlag1": false,
        "DocumentCustomFlag6": false,
        "DocumentCustomFlag2": false,
        "DocumentCustomFlag7": false,
        "DocumentCustomFlag3": false,
        "DocumentCustomFlag8": false,
        "DocumentCustomFlag4": false,
        "DocumentCustomFlag9": false,
        "DocumentCustomFlag5": false,
        "DocumentCustomFlag10": false,
        "DocumentShippingProviderID": 0,
        "DocumentTrackingID": "",
        "DocumentComments": "",
        "DocumentTags": "",
        "DocumentPaymentTermsEnumeration": "None",
        "DocumentPaymentMethod": "None",
        "DocumentParentDocId": 0,
        "DocumentHandlingDocId": 0,
        "DocumentTotalQuantity": 2,
        "DocumentAmountSubtotalWithoutTaxAndDiscount": 0,
        "DocumentAmountShipping": 0,
        "DocumentAmountTotalDiscount": 0,
        "DocumentAmountTotalTax": 0,
        "DocumentAmountGrandTotal": 0,
        "DocumentDetails": [
          {
            "DocumentRowDetailID": 26515,
            "DocumentRowProductID": 6177,
            "DocumentRowProductSKU": "Sugar",
            "DocumentRowProductDescription": "For Coffee",
            "DocumentRowQuantity": 2,
            "DocumentRowUnitPriceWithoutTaxOrDiscount": 0,
            "DocumentRowTaxID": 0,
            "DocumentTotalTaxAmount": 0,
            "DocumentRowDiscountID": 0,
            "DocumentRowTotalDiscountAmount": 0,
            "DocumentRowTotalAmount": 0,
            "DocumentRowSerialNumbers": [],
            "DocumentRowBatchNumbers": [],
            "DocumentRowRemarks": ""
          }
        ],
        "DocumentStatus": "Verified",
        "chkReOpenOrCloseRelatedDocs": false,
        "DocumentCreationDate": "/Date(1700656236565+0200)/",
        "DocumentLastUpdatedDate": "/Date(1700656236582+0200)/"
      },
      "ResponseStatus": {
        "ErrorCode": "0"
      },
      "entityID": 23760
    }
  ],
  "ResponseStatus": {
    "ErrorCode": "0",
    "Message": "All Documents were updated successfully."
  }
}

To override the Content-type in your clients HTTP Accept Header, append the .csv suffix or ?format=csv

HTTP + CSV

The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.

POST /csv/reply/DocumentsUpdate HTTP/1.1 
Host: api.megaventory.com 
Content-Type: text/csv
Content-Length: length

mvDocument,mvRecordAction
"{DocumentId:0,DocumentTypeId:0,DocumentTypeAbbreviation:String,DocumentTypeDescription:String,DocumentNo:String,DocumentReferenceNo:String,DocumentReferenceApplication:String,DocumentDate:0001-01-01,DocumentCustomOrderDate1:0001-01-01,DocumentCustomOrderDate2:0001-01-01,DocumentCurrencyCode:String,DocumentSupplierClientID:0,DocumentSupplierClientName:String,DocumentBillingAddress:String,DocumentAddress:String,DocumentAddresses:[{AddressType:General,AddressLine1:String,AddressLine2:String,AddressLine3:String,Name:String,Phone:String,Email:String,TaxIdNumber:String,Organization:String,City:String,State:String,Country:NONE,CountryName:String,Longitude:String,Latitude:String,ZipCode:String}],DocumentContactPerson:String,DocumentInventoryLocationID:0,DocumentCustomFlag1:False,DocumentCustomFlag6:False,DocumentCustomFlag2:False,DocumentCustomFlag7:False,DocumentCustomFlag3:False,DocumentCustomFlag8:False,DocumentCustomFlag4:False,DocumentCustomFlag9:False,DocumentCustomFlag5:False,DocumentCustomFlag10:False,DocumentShippingProviderID:0,DocumentTrackingID:String,DocumentShippingInfo:{ProviderInfo:{ProviderId:0,ServiceId:String,PackageId:String},CostInfo:{ShippingCost:0,OtherCosts:0,TotalCost:0},WeightInfo:{Weight:0,WeightUnitId:0},ShipDateInfo:{ShipDate:String},GenericAftersalesProServicesInfo:{COD:False,GTEEC:False,Protocol:False,Reception:False,Insurance:False,ChequeCod:False,SpecialRate:False,VipDelivery:False,SenderCharge:False,PackageReturn:False,ReturnDocument:False,CodTotalInCents:0,MorningDelivery:False,SameDayIntracity:False,SaturdayDelivery:False,SeaFreightCyprus:False,RefrigeratedGoods:False,LessThanTwoKilograms:False,LessThanFourKilograms:False,SubmissionOfTenderDocuments:False,NextDayAirTransportToIslands:False,ContainsDocumentsOnlyAndIsLessThanTwoKilograms:False},TrackingId:String,LockerId:0},DocumentComments:String,DocumentTags:String,DocumentPaymentTermsEnumeration:None,DocumentPaymentMethod:None,DocumentParentDocId:0,DocumentHandlingDocId:0,DocumentTotalQuantity:0,DocumentAmountSubtotalWithoutTaxAndDiscount:0.00,DocumentAmountShipping:0.00,DocumentAmountTotalDiscount:0.00,DocumentAmountTotalTax:0.00,DocumentAmountGrandTotal:0.00,DocumentTotalWeight:0,DocumentTotalWeightUnitID:0,DocumentDetails:[{DocumentRowDetailID:0,DocumentRowProductID:0,DocumentRowProductSKU:String,DocumentRowProductDescription:String,DocumentRowQuantity:0,DocumentRowUnitPriceWithoutTaxOrDiscount:0.00,DocumentRowTaxID:0,DocumentTotalTaxAmount:0.00,DocumentRowDiscountID:0,DocumentRowTotalDiscountAmount:0.00,DocumentRowTotalAmount:0.00,DocumentRowSerialNumbers:[String],DocumentRowBatchNumbers:[{BatchNumberName:String,ExpiryDate:0001-01-01,AssignedQTYInDetail:0}],DocumentRowRemarks:String,DocumentRowTotalWeight:0,DocumentRowTotalWeightUnitID:0}],DocumentStatus:ValidStatus,chkReOpenOrCloseRelatedDocs:False,DocumentCreationDate:0001-01-01,DocumentLastUpdatedDate:0001-01-01}",Insert

HTTP/1.1 200 OK
Content-Type: text/csv
Content-Length: length

mvDocument,ResponseStatus,entityID,InternalErrorCode
"{DocumentId:0,DocumentTypeId:0,DocumentTypeAbbreviation:String,DocumentTypeDescription:String,DocumentNo:String,DocumentReferenceNo:String,DocumentReferenceApplication:String,DocumentDate:0001-01-01,DocumentCustomOrderDate1:0001-01-01,DocumentCustomOrderDate2:0001-01-01,DocumentCurrencyCode:String,DocumentSupplierClientID:0,DocumentSupplierClientName:String,DocumentBillingAddress:String,DocumentAddress:String,DocumentAddresses:[{AddressType:General,AddressLine1:String,AddressLine2:String,AddressLine3:String,Name:String,Phone:String,Email:String,TaxIdNumber:String,Organization:String,City:String,State:String,Country:NONE,CountryName:String,Longitude:String,Latitude:String,ZipCode:String}],DocumentContactPerson:String,DocumentInventoryLocationID:0,DocumentCustomFlag1:False,DocumentCustomFlag6:False,DocumentCustomFlag2:False,DocumentCustomFlag7:False,DocumentCustomFlag3:False,DocumentCustomFlag8:False,DocumentCustomFlag4:False,DocumentCustomFlag9:False,DocumentCustomFlag5:False,DocumentCustomFlag10:False,DocumentShippingProviderID:0,DocumentTrackingID:String,DocumentShippingInfo:{ProviderInfo:{ProviderId:0,ServiceId:String,PackageId:String},CostInfo:{ShippingCost:0,OtherCosts:0,TotalCost:0},WeightInfo:{Weight:0,WeightUnitId:0},ShipDateInfo:{ShipDate:String},GenericAftersalesProServicesInfo:{COD:False,GTEEC:False,Protocol:False,Reception:False,Insurance:False,ChequeCod:False,SpecialRate:False,VipDelivery:False,SenderCharge:False,PackageReturn:False,ReturnDocument:False,CodTotalInCents:0,MorningDelivery:False,SameDayIntracity:False,SaturdayDelivery:False,SeaFreightCyprus:False,RefrigeratedGoods:False,LessThanTwoKilograms:False,LessThanFourKilograms:False,SubmissionOfTenderDocuments:False,NextDayAirTransportToIslands:False,ContainsDocumentsOnlyAndIsLessThanTwoKilograms:False},TrackingId:String,LockerId:0},DocumentComments:String,DocumentTags:String,DocumentPaymentTermsEnumeration:None,DocumentPaymentMethod:None,DocumentParentDocId:0,DocumentHandlingDocId:0,DocumentTotalQuantity:0,DocumentAmountSubtotalWithoutTaxAndDiscount:0.00,DocumentAmountShipping:0.00,DocumentAmountTotalDiscount:0.00,DocumentAmountTotalTax:0.00,DocumentAmountGrandTotal:0.00,DocumentTotalWeight:0,DocumentTotalWeightUnitID:0,DocumentDetails:[{DocumentRowDetailID:0,DocumentRowProductID:0,DocumentRowProductSKU:String,DocumentRowProductDescription:String,DocumentRowQuantity:0,DocumentRowUnitPriceWithoutTaxOrDiscount:0.00,DocumentRowTaxID:0,DocumentTotalTaxAmount:0.00,DocumentRowDiscountID:0,DocumentRowTotalDiscountAmount:0.00,DocumentRowTotalAmount:0.00,DocumentRowSerialNumbers:[String],DocumentRowBatchNumbers:[{BatchNumberName:String,ExpiryDate:0001-01-01,AssignedQTYInDetail:0}],DocumentRowRemarks:String,DocumentRowTotalWeight:0,DocumentRowTotalWeightUnitID:0}],DocumentStatus:ValidStatus,chkReOpenOrCloseRelatedDocs:False,DocumentCreationDate:0001-01-01,DocumentLastUpdatedDate:0001-01-01}","{ErrorCode:String,Message:String,StackTrace:String,Errors:[{ErrorCode:String,FieldName:String,Message:String}]}",0,String