Stock On Hand

Allows customers to retreive Stock on Hand details for products.

Note: There is a limit of 30 products allowed at once.

Access

To get access to this API, please fill in the Developer Registration form

Resource URI

Make an HTTP POST request to:

https://api.mainfreight.com/Warehousing/1.1/Customers/Products/StockOnHand?region={add region}

Resource Information

TypeValue 
Authentication API Key  
Response Formats JSON / XML  
HTTP Methods POST  
API Version 1.1  

HTTP Headers

You must add the following HTTP Headers to your request:

HeaderTypeDescription
Content-Type string Request content type. Supported types are "application/json" or "application/xml."
Authorization string

The word "Secret" followed by a space, then your unique Logistics API Key.

e.g: Secret wdnOId93-VXZECxvVRPQEJZNxPB5XZ...

Parameters

You must provide the parameters marked as required:

HTTP Request Parameters

HeaderDescriptionTypeRequired
region

Region code, a list of supported regions for each country can be found here

string Yes

Fields

You must provide the fields marked as required:

Request Body

FieldDescriptionTypeLengthRequired
warehouse  Warehouse that can be indentified in our system array   Yes
code  Warehouse code value string  50  Yes
customer  Customer that can be indentified in our system array   Yes
code  Customer code value string   50  Yes
 products  List of Products that can be identified in our system array   Yes
code  Product SKU in our system string  50  No

 

Response Body

FieldTypeDescription
products string  
 code string product code value
 displayName string product description value
 balance array  
stockOnHand integer  Number of units on hand
committed integer  Number of units committed to transactions
available integer  Number of units available
receiving integer  Number of units being transferred
damaged integer  Number of units under damage status
onHold integer  Number of units under onHold status
reserved integer  Number of units reserved for transactions
restricted integer  Number of units under restricted status
availableToOrder integer  Number of units avaiable to order
held integer  Number of units held by transactions
enteredStock integer  Number of units assigned to unprocessed transactions
balanceDetails array  
balanceDetail object  
stockOnHand integer  Number of units on hand
committed integer  Number of units committed to transactions
available integer  Number of units available
receiving integer  Number of units being transferred
damaged integer  Number of units under damage status
onHold integer  Number of units under onHold status
reserved integer  Number of units reserved for transactions
restricted integer  Number of units under restricted status
availableToOrder integer  Number of units avaiable to order
held integer  Number of units held by transactions
enteredStock integer  Number of units assigned to unprocessed transactions
grade1 string

 Grade 1 attribute value

grade2 string  Grade 2 attribute value
grade3 string  Grade 3 attribute value
expiryDate date  Expiry date attribute value 
vfd string  Value for Duty
vti string  Value transport Insurance 
entryNo string  Entry Number 
entryLineNo string  Entry Line Number 

Code samples

JSON Example

To Get Stock On Hand in the JSON format you will need to POST a JSON Object:

  • URL
< > grab code
https://api.mainfreight.com/Warehousing/1.1/Customer/Products/StockOnHand?region=US

You are going to send a JSON object similar to this:

  • REQUEST JSON
< > grab code
{
   "warehouse": {
      "code": "{{warehouseCode}}"
   },
   "customer": {
      "code": "{{customerCode}}"
   },
	"products": [{
			"code": "269495"
		}, {
			"code": "065108A"
		}
	]
}

You are going get another JSON object similar to this:

  • RESPONSE JSON
< > grab code
[
    {
        "code": "269495",
        "displayName": "TENNIS BALL 24CM",
        "balance": {
            "stockOnHand": 0,
            "committed": 0,
            "available": 0,
            "receiving": 0,
            "damaged": 0,
            "onHold": 0,
            "reserved": 0,
            "restricted": 0,
            "availableToOrder": 0,
            "held": 0,
            "enteredStock": 0
        },
        "balanceDetails": [
            {
                "stockOnHand": 0,
                "committed": 0,
                "available": 0,
                "damaged": 0,
                "held": 0,
                "restricted": 86,
                "availableToOrder": 0,
                "entered": 0,
                "grade1": "012",
                "grade2": null,
                "grade3": null,
                "expiryDate": "2015-12-01",
                "vfd": null,
                "vti": null,
                "entryNo": null,
                "entryLineNo": null
            },
        ],
        {
            "code": "065108A",
            "displayName": "10'X30'STEEL PRO FRAME POOL",
            "balance": {
                "stockOnHand": 0,
                "committed": 0,
                "available": 460,
                "receiving": 0,
                "damaged": 0,
                "onHold": 0,
                "reserved": 0,
                "restricted": 0,
                "availableToOrder": 457,
                "held": 0,
                "enteredStock": 0
            },
            "balanceDetails": [
                {
                    "stockOnHand": 0,
                    "committed": 0,
                    "available": 0,
                    "damaged": 0,
                    "held": 0,
                    "restricted": 86,
                    "availableToOrder": 0,
                    "entered": 0,
                    "grade1": "012",
                    "grade2": null,
                    "grade3": null,
                    "expiryDate": "2015-12-01",
                    "vfd": null,
                    "vti": null,
                    "entryNo": null,
                    "entryLineNo": null
                },
            }
        ]
 
XML Example

To Get Stock on Hand in XML format, you will need to POST XML object. 

  • URL
< > grab code
https://api.mainfreight.com/Warehousing/1.1/Customer/Products/StockOnHand?region=US

You are going to send a XML object similar to this:

  • XML REQUEST
< > grab code
<stockOnHand>
<warehouse>
<code>1</code>
</warehouse>
<customer>
<code>43862</code>
</customer>
<products>
<product>
<code>ProductCode1</code>
</product>
</products>
</stockOnHand>

You are going to get a  XML document similar to this:

  • XML RESPONSE
< > grab code
 
<products xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <product>
        <code>1112</code>
        <description>Item OB serials</description>
        <balance>
            <stockOnHand>1470</stockOnHand>
            <committed>1</committed>
            <available>1321</available>
            <damaged>81</damaged>
            <held>67</held>
            <restricted>236</restricted>
            <availableToOrder>1230</availableToOrder>
            <entered>91</entered>
            <balanceDetails>
                <balanceDetail>
                    <stockOnHand>0</stockOnHand>
                    <committed>0</committed>
                    <available>0</available>
                    <damaged>0</damaged>
                    <held>0</held>
                    <restricted>86</restricted>
                    <availableToOrder>0</availableToOrder>
                    <entered>0</entered>
                    <grade1>012</grade1>
                    <expiryDate>2015-12-01</expiryDate>
                </balanceDetail>
            </balanceDetails>
        </balance>
    </product>
</products>
NOTE: Content in the panels below this point are not visible on the site unless used by other features e.g. gadgets, OB&E, etc.