Megaventory API v2017a

<back to all web services

ProductSupplierGet

Gets information on existing product-supplier relationshipsUses your API Key and some Filters in an array format and returns the search results using given filters. Optionally, 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 ReturnTopNRecords chooses the top records in a ProductID descending order. You can also use "IncludeReferencedObjects" to get additional data about lead time and quantity range

Examples:



A.

Return all the product suppliers that are linked to product with "ProductID = 1". The results are returned as mvProductSupplier objects.
We can add one Filter as shown below:

Value:

  {
   "Filters": [
      {
         "FieldName": "ProductID",
         "SearchOperator": "Equals",
         "SearchValue": "1"
      }
   ]
} 

Response:

 {
   "mvProductSupplier": [
      {
         "ProductID": 1,
         "ProductSupplierID": 2,
         "IsMainSupplier": false,
         "ProductSupplierPrice": 15.370000000,
         "ProductSupplierSKU": "PRODUCT_SUPPLIER_SKU_2",
         "ProductSupplierDescription": "A Product supplied by supplier id = 2",
         "ProductSupplierLeadTimeId": 2,
         "ProductSupplierQuantityRangeId": 0,
         "ProductSupplierLeadTimeExactDate": "/Date(16500108100000-0000)/"
      },
      {
         "ProductID": 1,
         "ProductSupplierID": 3,
         "IsMainSupplier": true,
         "ProductSupplierPrice": 10.190000000,
         "ProductSupplierSKU": "PRODUCT_SUPPLIER_SKU_3",
         "ProductSupplierDescription": "A Product supplied by supplier id = 3",
         "ProductSupplierLeadTimeId": -99,
         "ProductSupplierQuantityRangeId": 0,
         "ProductSupplierLeadTimeExactDate": "/Date(-62135596800000-0000)/"
      }
   ],
   "ResponseStatus": {
      "ErrorCode": "0"
   }
}

B.

Get additional lead time and quantity data using the "IncludeReferencedObjects" flag:

Value:

  {
   "includeReferencedObjects": true
} 

Response:

 {
   "mvProductSupplier": [
      {
         "ProductID": 1,
         "ProductSupplierID": 2,
         "IsMainSupplier": false,
         "ProductSupplierPrice": 15.370000000,
         "ProductSupplierSKU": "PRODUCT_SUPPLIER_SKU_2",
         "ProductSupplierDescription": "A Product supplied by supplier id = 2",
         "ProductSupplierLeadTimeId": 2,
         "ProductSupplierLeadTime": {
            "LeadTimeID": 2,
            "LeadTimeDescription": "Exact date",
            "LeadTimeMinDaysFromNow": 1,
            "LeadTimeMaxDaysFromNow": 5,
            "LeadTimeColorOption": "FF0000",
            "LeadTimeDisplayOrder": 1,
            "LeadTimeIsDefault": false,
            "LeadTimeSupplierID": 5
         },
         "ProductSupplierQuantityRangeId": 0,
         "ProductSupplierQuantityRange": {
                "QuantityRangeID": 0,
                "QuantityRangeDescription": "Exact",
                "QuantityRangeMinQuantity": 1.000000000,
                "QuantityRangeMaxQuantity": 5.000000000,
                "QuantityRangeColorOption": "3399FF",
                "QuantityRangeDisplayOrder": 1,
                "QuantityRangeIsDefault": false
         },
         "ProductSupplierLeadTimeExactDate": "/Date(16500108100000-0000)/"
      },
      {
         "ProductID": 2,
         "ProductSupplierID": 3,
         "IsMainSupplier": true,
         "ProductSupplierPrice": 10.870000000,
         "ProductSupplierSKU": "PRODUCT_SUPPLIER_SKU_3",
         "ProductSupplierDescription": "A Product supplied by supplier id = 3",
         "ProductSupplierLeadTimeId": -99,
         "ProductSupplierQuantityRangeId": 0,
         "ProductSupplierQuantityRange": {
                "QuantityRangeID": 0,
                "QuantityRangeDescription": "Exact",
                "QuantityRangeMinQuantity": 1.000000000,
                "QuantityRangeMaxQuantity": 5.000000000,
                "QuantityRangeColorOption": "3399FF",
                "QuantityRangeDisplayOrder": 1,
                "QuantityRangeIsDefault": false
         },
         "ProductSupplierLeadTimeExactDate": "/Date(-62135596800000-0000)/"
      }
   ],
   "ResponseStatus": {
      "ErrorCode": "0"
   }
}

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

HTTP + SOAP12

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

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

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

<ProductSupplierGet xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/Megaventory.APIEndpoints.Operations">
  <Filters xmlns="http://schemas.datacontract.org/2004/07/Megaventory.APIEndpoints">
    <Filter>
      <AndOr>And</AndOr>
      <FieldName>String</FieldName>
      <Group>Undefined</Group>
      <SearchOperator>Undefined</SearchOperator>
      <SearchValue>String</SearchValue>
    </Filter>
  </Filters>
  <ReturnTopNRecords xmlns="http://schemas.datacontract.org/2004/07/Megaventory.APIEndpoints">0</ReturnTopNRecords>
  <APIKEY>String</APIKEY>
  <IncludeReferencedObjects>false</IncludeReferencedObjects>
</ProductSupplierGet>

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

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

<ProductSupplierGetResponse xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/Megaventory.APIEndpoints.Operations">
  <mvProductSupplier xmlns:d2p1="https://api.megaventory.com/types">
    <d2p1:mvProductSupplier i:nil="true" />
  </mvProductSupplier>
  <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>
</ProductSupplierGetResponse>

    </soap12:Body>
</soap12:Envelope>