Megaventory API v2017a

<back to all web services

BatchNumberGet

Gets 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 .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: BatchNumberGet

<?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>

<BatchNumberGet 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">-1</ReturnTopNRecords>
  <APIKEY>String</APIKEY>
  <SortBy>Undefined</SortBy>
  <Page>0</Page>
  <Limit>0</Limit>
</BatchNumberGet>

    </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>

<BatchNumberGetResponse xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/Megaventory.APIEndpoints.Operations">
  <mvBatchNumbers xmlns:d2p1="https://api.megaventory.com/types">
    <d2p1:mvBatchNumber>
      <d2p1:BatchNumberArchiveFlag>false</d2p1:BatchNumberArchiveFlag>
      <d2p1:BatchNumberDescription>String</d2p1:BatchNumberDescription>
      <d2p1:BatchNumberId>0</d2p1:BatchNumberId>
      <d2p1:BatchNumberInventoryLocationName>String</d2p1:BatchNumberInventoryLocationName>
      <d2p1:BatchNumberName>String</d2p1:BatchNumberName>
      <d2p1:BatchNumberProductDescription>String</d2p1:BatchNumberProductDescription>
      <d2p1:BatchNumberProductSKU>String</d2p1:BatchNumberProductSKU>
      <d2p1:DateCreated>0001-01-01T00:00:00</d2p1:DateCreated>
      <d2p1:ExpiryDate>0001-01-01T00:00:00</d2p1:ExpiryDate>
      <d2p1:InventoryLocationId>0</d2p1:InventoryLocationId>
      <d2p1:ProductId>0</d2p1:ProductId>
      <d2p1:SupplierBatchNumber>String</d2p1:SupplierBatchNumber>
      <d2p1:TotalBatchNumberQTY>0</d2p1:TotalBatchNumberQTY>
    </d2p1:mvBatchNumber>
  </mvBatchNumbers>
  <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>
</BatchNumberGetResponse>

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