Scenario: Get Quantity for Item(s)


MethodName: GetItemQuantity()


Inputs:

  • WebsiteIDRequired
    • Used to identify configuration
  • Item
    • Required, used for linking items
    • Note: Item can be passed multiple times.


Logic:


Step 1: Process Inventory Control Settings

This method provides support for the following Commerce5 settings to keep inventory calculations consistent with those that are being synchronized through Commerce5.

  • ITEM_QTY_METH

    • A for Qty Available

    • H for Qty on Hand

  • QTY_LOC_METH

    • S = Stocking Location

    • A = All Locations

    • G = Location Group

  • LOC_GRP_ID

    • Location Group (only used if QTY_LOC_METH = G)

  • STK_LOC_ID

    • Stocking Location (Only used if QTY_LOC_METH = S)


The Commerce5 configured settings at the time of this writing are:


  • ITEM_QTY_METH = A
  • QTY_LOC_METH = S
  • STK_LOC_ID = 01


Step 2: Calculate Inventory Quantity

Input Item(s) are linked to IM_INV.ITEM_NO and inventory is summarized based on the settings in Step 1.


Step 3: Return Quantities

Duplicate items will be removed.

Use:

https://localhost:50937/c5coreapi/?APIToken=123456&action=GetItemQuantity&WebsiteID=www.mywebsite.com&Item=*060-1&Item=100008&Item=100001 


https://192.168.0.167:50937/c5coreapi/?APIToken=123456&action=GetItemQuantity&WebsiteID=www.mywebsite.com&Item=*060-1&Item=100008&Item=100001 


Returns: 

{

"Items": [{

"Item": "*060-1", 

"Quantity": 0

}, {

"Item": "100008",

"Quantity": 6

}, {

"Item": "100001",

"Quantity": 208

}]

}


Returns: 

{

"Items": []

}


Returns: 

{

"Error": "Error Message."

}