Megaventory API v2017a

<back to all web services

ProductBOMUpdate

The following routes are available for this service:
POST/ProductBOM/ProductBOMUpdateInserts a product's bill of materials or updates a current one.Uses your API Key and applies a mvRecordAction value on an mvProductBOM object. We can insert the mvProductBOM object we specified using "Insert" as our mvRecordAction. We can update a current BoM using "Update", we can insert it if it doesn't already exist, update it if it does using "InsertOrUpdate" and we can insert new fields or update non-empty fields of the BoM using "InsertOrUpdateNonEmptyFields". Optionally, you can use mvInsertUpdateDeleteSourceApplication when an external application ( eg Magento ) is the one that triggers the ProductBOMUpdate call.

Examples:



A.

Update a product's bill of materials. ProductBOMUpdate call was triggered by Magento.

Value:

 {
   "mvProductBOM": {
      "ProductID": "27412",
      "ProductSKU": "prod111",
      "mvRawMaterials": [
         {
            "ProductID": "27396",
            "ProductSKU": "PROD11",
            "ProductDescription": "PROD11",
            "RawMaterialQuantity": "1"
         }
      ]
   },
   "mvRecordAction": "Update",
   "mvInsertUpdateDeleteSourceApplication": "Magento"
} 


Response:

 {
   "mvProductBOM": {
      "ProductID": 27412,
      "ProductSKU": "prod111",
      "mvRawMaterials": [
         {
            "ProductID": 27396,
            "ProductSKU": "PROD11",
            "ProductDescription": "PROD11",
            "RawMaterialQuantity": 1
         }
      ]
   },
   "ResponseStatus": {
      "ErrorCode": "0"
   },
   "entityID": 27412
} 

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/ProductBOMUpdate HTTP/1.1 
Host: api.megaventory.com 
Content-Type: text/csv
Content-Length: length

ProductID,ProductSKU,mvRawMaterials
0,String,"[{ProductID:0,ProductSKU:String,ProductDescription:String,RawMaterialQuantity:0,RawMaterialQuantitySlackPercent:0.0,FinishedGoodQuantitySlackPercent:0.0}]"

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

ProductID,ProductSKU,mvRawMaterials
0,String,"[{ProductID:0,ProductSKU:String,ProductDescription:String,RawMaterialQuantity:0,RawMaterialQuantitySlackPercent:0.0,FinishedGoodQuantitySlackPercent:0.0}]"