Megaventory API v2017a

<back to all web services

ProductSupplierGet

The following routes are available for this service:
GET POST/ProductSupplier/ProductSupplierGetGets 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 .json suffix or ?format=json

To embed the response in a jsonp callback, append ?callback=myCallback

HTTP + JSON

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

POST /json/reply/ProductSupplierGet HTTP/1.1 
Host: api.megaventory.com 
Content-Type: application/json
Content-Length: length

{"Filters":[{"AndOr":"And","Group":"Undefined","FieldName":"String","SearchOperator":"Undefined","SearchValue":"String"}],"ReturnTopNRecords":0,"APIKEY":"String","IncludeReferencedObjects":false}
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: length

{"mvProductSupplier":[{}],"ResponseStatus":{"ErrorCode":"String","Message":"String","StackTrace":"String","Errors":[{"ErrorCode":"String","FieldName":"String","Message":"String"}]},"InternalErrorCode":"String"}