Megaventory API v2017a

<back to all web services

ProductBOMGetByMaterials

Gets information on a product's bill of materials. Uses your API Key and some Raw Materials in an array format and returns the BOMs that contain the specified raw materials. You can use ExactMatch to specify if the BOMs should contain the exact raw materials specified or not. You can use ReturnTopNRecords to limit the number of the results to the specified number (omit, or add ReturnTopNRecords = -1 to get all the available results). The results are sorted by Finished Good ProductID in ascending order.



Examples:



A.

Return the mvProductBOMs objects whose raw materials contain the specified raw materials. The results are returned as mvProductBOMs objects.

Value:

{
    "ExactMatch":false,
    "mvRawMaterials": [
        {
          "ProductSKU": "prod-1",
          "Quantity": 1
        },
        {
          "ProductSKU": "prod-2",
          "Quantity": 1
        }
    ]
}

Response:

{
   "mvProductBOMs": [
    {
      "ProductID": 7574,
      "ProductSKU": "fg",
      "mvRawMaterials": [
        {
          "ProductID": 7535,
          "ProductSKU": "prod-1",
          "ProductDescription": "My Products",
          "RawMaterialQuantity": 1,
          "RawMaterialQuantitySlackPercent": 0,
          "FinishedGoodQuantitySlackPercent": 0
        },
        {
          "ProductID": 7536,
          "ProductSKU": "prod-2",
          "ProductDescription": "My Products",
          "RawMaterialQuantity": 1,
          "RawMaterialQuantitySlackPercent": 0,
          "FinishedGoodQuantitySlackPercent": 0
        }
      ]
    },
    {
      "ProductID": 7577,
      "ProductSKU": "fg1",
      "mvRawMaterials": [
        {
          "ProductID": 7535,
          "ProductSKU": "prod-1",
          "ProductDescription": "My Products",
          "RawMaterialQuantity": 1,
          "RawMaterialQuantitySlackPercent": 0,
          "FinishedGoodQuantitySlackPercent": 0
        },
        {
          "ProductID": 7536,
          "ProductSKU": "prod-2",
          "ProductDescription": "My Products",
          "RawMaterialQuantity": 1,
          "RawMaterialQuantitySlackPercent": 0,
          "FinishedGoodQuantitySlackPercent": 0
        },
        {
          "ProductID": 7537,
          "ProductSKU": "prod-3",
          "ProductDescription": "My Products",
          "RawMaterialQuantity": 1,
          "RawMaterialQuantitySlackPercent": 0,
          "FinishedGoodQuantitySlackPercent": 0
        }
      ]
    }
  ],
   "ResponseStatus": {
      "ErrorCode": "0"
   }
}


B.

Return the mvProductBOMs objects whose raw materials are exactly the specified raw materials. The results are returned as mvProductBOMs objects.

Value:

{
    "ExactMatch":true,
    "mvRawMaterials": [
        {
          "ProductSKU": "prod-1",
          "Quantity": 1
        },
        {
          "ProductSKU": "prod-2",
          "Quantity": 1
        }
    ]
}

Response:

{
   "mvProductBOMs": [
    {
      "ProductID": 7574,
      "ProductSKU": "fg",
      "mvRawMaterials": [
        {
          "ProductID": 7535,
          "ProductSKU": "prod-1",
          "ProductDescription": "My Products",
          "RawMaterialQuantity": 1,
          "RawMaterialQuantitySlackPercent": 0,
          "FinishedGoodQuantitySlackPercent": 0
        },
        {
          "ProductID": 7536,
          "ProductSKU": "prod-2",
          "ProductDescription": "My Products",
          "RawMaterialQuantity": 1,
          "RawMaterialQuantitySlackPercent": 0,
          "FinishedGoodQuantitySlackPercent": 0
        }
      ]
    }
  ],
   "ResponseStatus": {
      "ErrorCode": "0"
   }
}

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

HTTP + SOAP11

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

POST /soap11 HTTP/1.1 
Host: api.megaventory.com 
Content-Type: text/xml; charset=utf-8
Content-Length: length
SOAPAction: ProductBOMGetByMaterials

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
    <soap:Body>

<ProductBOMGetByMaterials xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/Megaventory.APIEndpoints.Operations">
  <APIKEY>String</APIKEY>
  <mvRawMaterials xmlns:d2p1="https://api.megaventory.com/types">
    <d2p1:MvRawMaterial>
      <d2p1:ProductID>0</d2p1:ProductID>
      <d2p1:ProductSKU>String</d2p1:ProductSKU>
      <d2p1:Quantity>0</d2p1:Quantity>
    </d2p1:MvRawMaterial>
  </mvRawMaterials>
  <ExactMatch>false</ExactMatch>
  <ReturnTopNRecords>0</ReturnTopNRecords>
</ProductBOMGetByMaterials>

    </soap:Body>
</soap:Envelope>
HTTP/1.1 200 OK
Content-Type: application/xml
Content-Length: length

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
    <soap:Body>

<ProductBOMGetByMaterialsResponse xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/Megaventory.APIEndpoints.Operations">
  <mvProductBOMs xmlns:d2p1="https://api.megaventory.com/types">
    <d2p1:mvProductBOM>
      <d2p1:ProductID>0</d2p1:ProductID>
      <d2p1:ProductSKU>String</d2p1:ProductSKU>
      <d2p1:mvRawMaterials>
        <d2p1:mvRawMaterialItem i:nil="true" />
      </d2p1:mvRawMaterials>
    </d2p1:mvProductBOM>
  </mvProductBOMs>
  <ResponseStatus xmlns:d2p1="http://schemas.servicestack.net/types">
    <d2p1:ErrorCode>String</d2p1:ErrorCode>
    <d2p1:Message>String</d2p1:Message>
    <d2p1:StackTrace>String</d2p1:StackTrace>
    <d2p1:Errors>
      <d2p1:ResponseError>
        <d2p1:ErrorCode>String</d2p1:ErrorCode>
        <d2p1:FieldName>String</d2p1:FieldName>
        <d2p1:Message>String</d2p1:Message>
      </d2p1:ResponseError>
    </d2p1:Errors>
  </ResponseStatus>
  <InternalErrorCode>String</InternalErrorCode>
</ProductBOMGetByMaterialsResponse>

    </soap:Body>
</soap:Envelope>