Megaventory API v2017a

<back to all web services

BatchNumberGet

The following routes are available for this service:
GET POST/Product/BatchNumberGetGets information on existing batch numbersUses your API Key along with optional Filters, Sorting, and Pagination parameters to retrieve Batch Number information. If no Filters are provided, all batch numbers will be returned.

Query Parameters:


  • SortBy (string, optional) = ['Undefined', 'ByExpiryDate', 'ByCreationDate', 'ByName']
  • Page (int, optional) = Page number starting from 1
  • Limit (int, optional) = Maximum number of records per page (max 1000)

Examples:



A.

Return all batch numbers (no filters) with default sorting and pagination

Value:

{
  "Page": 1,
  "Limit": 100
}


Response:

{
  "mvBatchNumbers": [
    {
      "BatchNumberId": 503,
      "BatchNumberName": "BatchA",
      "ProductId": 7571,
      "InventoryLocationId": 6770,
      "DateCreated": "/Date(1727691143980-0000)/",
      "ExpiryDate": "/Date(1725397200000-0000)/",
      "TotalBatchNumberQTY": 0,
      "BatchNumberInventoryLocationName": "Paris Warehouse",
      "BatchNumberProductSKU": "SKU-ABC123",
      "BatchNumberArchiveFlag": false,
      "BatchNumberProductDescription": "Premium Face Cream 50ml"
    }
  ],
  "ResponseStatus": {
    "ErrorCode": "0"
  }
}


B.

Return batch numbers with a BatchNumberName of either "BatchA" or "BatchB" sorted by Expiry Date, page 2 with 50 results per page

Value:

{
  "SortBy": "ByExpiryDate",
  "Page": 2,
  "Limit": 50,
  "Filters": [
    {
      "FieldName": "BatchNumberName",
      "SearchOperator": "Equals",
      "SearchValue": "BatchA"
    },
    {
      "AndOr": "Or",
      "FieldName": "BatchNumberName",
      "SearchOperator": "Equals",
      "SearchValue": "BatchB"
    }
  ]
}


Response:

{
  "mvBatchNumbers": [
    {
      "BatchNumberId": 503,
      "BatchNumberName": "BatchA",
      "ProductId": 7571,
      "InventoryLocationId": 6770,
      "DateCreated": "/Date(1727691143980-0000)/",
      "ExpiryDate": "/Date(1725397200000-0000)/",
      "TotalBatchNumberQTY": 0,
      "BatchNumberInventoryLocationName": "Paris Warehouse",
      "BatchNumberProductSKU": "SKU-ABC123",
      "BatchNumberArchiveFlag": false,
      "BatchNumberProductDescription": "Premium Face Cream 50ml"
    },
    {
      "BatchNumberId": 341,
      "BatchNumberName": "BatchB",
      "ProductId": 7571,
      "InventoryLocationId": 6770,
      "DateCreated": "/Date(1725280940387-0000)/",
      "ExpiryDate": "/Date(1727643600000-0000)/",
      "TotalBatchNumberQTY": 10,
      "BatchNumberInventoryLocationName": "Paris Warehouse",
      "BatchNumberProductSKU": "SKU-ABC123",
      "BatchNumberArchiveFlag": false,
      "BatchNumberProductDescription": "Premium Face Cream 50ml"
    },
    {
      "BatchNumberId": 347,
      "BatchNumberName": "BatchB",
      "ProductId": 7572,
      "InventoryLocationId": 6770,
      "DateCreated": "/Date(1725281874650-0000)/",
      "ExpiryDate": "/Date(1727643600000-0000)/",
      "TotalBatchNumberQTY": 0,
      "BatchNumberInventoryLocationName": "Paris Warehouse",
      "BatchNumberProductSKU": "SKU-XYZ789",
      "BatchNumberArchiveFlag": false,
      "BatchNumberProductDescription": "Vitamin D3 Supplement 30caps"
    }
  ],
  "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/BatchNumberGet 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"}],"APIKEY":"String","SortBy":"Undefined","Page":0,"Limit":0}
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: length

{"mvBatchNumbers":[{"BatchNumberId":0,"BatchNumberName":"String","SupplierBatchNumber":"String","ProductId":0,"InventoryLocationId":0,"DateCreated":"\/Date(-62135596800000-0000)\/","ExpiryDate":"\/Date(-62135596800000-0000)\/","TotalBatchNumberQTY":0,"BatchNumberDescription":"String","BatchNumberInventoryLocationName":"String","BatchNumberProductSKU":"String","BatchNumberArchiveFlag":false,"BatchNumberProductDescription":"String"}],"ResponseStatus":{"ErrorCode":"String","Message":"String","StackTrace":"String","Errors":[{"ErrorCode":"String","FieldName":"String","Message":"String"}]}}