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 access to Mainfreight APIs, you have to Register

Resource URI

Make an HTTP POST request to:

https://api.mainfreight.com/Logistics/1.0/Customers/Products/StockOnHand

Resource Information

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

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

RequestedBy string Please provide your application name.

Parameters

You must provide the following parameters:

Request Parameters

ParameterTypeDescription
stockOnHand string  
 parties array List of References that can be indentified in our system.
 partyType string Party type, list of available types can be found here
 code string Party code.
 products Array List of Products that can be identified in our system
code string Product code value in our system

Response Parameters

ParameterTypeDescription
products string  
 id string product id value
 code string product code value
 displayName string Rep Code 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
 attributeBalances 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
attributes Array List of available atrributes available for products
attributeType string Attribute type, list of available attribute types can be found here
value string,Date Attribute value

Code samples

JSON Example

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

  • URL
< > grab code
https://api.mainfreight.com/Logistics/1.0/Customer/Products/StockOnHand

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

  • REQUEST JSON
< > grab code
{
	"parties": [{
			"partyType": "Customer",
			"code": "43862"
		}, {
			"partyType": "Warehouse",
			"code": "77"
		}
	],
	"products": [{
			"code": "269495"
		}, {
			"code": "065108A"
		}
	]
}

You are going get another JSON object similar to this:

  • RESPONSE JSON
< > grab code
[
    {
        "id": "C69A8A6A-E2BE-4959-852A-D314CBAE27A9",
        "code": "269495",
        "displayName": "TENNIS BALL 24CM",
        "alternativeDisplayName": null,
        "balance": {
            "": 0,
            "committed": 0,
            "available": 0,
            "receiving": 0,
            "damaged": 0,
            "onHold": 0,
            "reserved": 0,
            "restricted": 0,
            "availableToOrder": 0,
            "held": 0,
            "enteredStock": 0
        },
        "attributeBalances": []
    },
    {
        "id": "FBD9DD92-1978-497C-9702-1DEE12854511",
        "code": "065108A",
        "displayName": "10'X30'STEEL PRO FRAME POOL",
        "alternativeDisplayName": null,
        "balance": {
            "": 0,
            "committed": 0,
            "available": 460,
            "receiving": 0,
            "damaged": 0,
            "onHold": 0,
            "reserved": 0,
            "restricted": 0,
            "availableToOrder": 457,
            "held": 0,
            "enteredStock": 0
        },
        "attributeBalances": [
            {
                "balance": {
                    "": 0,
                    "committed": 0,
                    "available": 460,
                    "receiving": 0,
                    "damaged": 0,
                    "onHold": 0,
                    "reserved": 0,
                    "restricted": 0,
                    "availableToOrder": 0,
                    "held": 0,
                    "enteredStock": 3
                },
                "attributes": [
                    {
                        "attributeType": "Grade1",
                        "value": "Grade1"
                    },
                    {
                        "attributeType": "Grade2",
                        "value": "Grade2"
                    },
                    {
                        "attributeType": "Grade3",
                        "value": "Grade3"
                    },
                    {
                        "attributeType": "ArrivalDate",
                        "value": "2017-03-14T13:09:00.637"
                    },
                    {
                        "attributeType": "ExpiryDate",
                        "value": "1900-01-01"
                    },
                    {
                        "attributeType": "PackingDate",
                        "value": "1900-01-01"
                    }
                ]
            }
        ]
    }
]
XML Example

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

  • URL
< > grab code
https://api.mainfreight.com/Logistics/1.0/Customer/Products/StockOnHand

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

  • XML REQUEST
< > grab code
<stockOnHand>
<parties>
<party>
<partyType>Warehouse</partyType>
<code>1</code>
</party>
<party>
<partyType>Customer</partyType>
<code>43862</code>
</party>
</parties>
<products>
<product>
<code>ProductCode1</code>
</product>
</products>
</stockOnHand>

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

  • XML RESPONSE
< > grab code
<products>
<product>
<id>CA9A8A6A-E2BE-4959-852A-D314CBAE27A9</id>
<code>ProdcutCode1</code>
<displayName>Product Description</displayName>
<balance>
<stockOnHand>0</stockOnHand>
<committed>0</committed>
<available>100</available>
<receiving>0</receiving>
<damaged>0</damaged>
<onHold>0</onHold>
<reserved>0</reserved>
<restricted>0</restricted>
<availableToOrder>30</availableToOrder>
<held>0</held>
<enteredStock>0</enteredStock>
</balance>
<attributeBalances>
<attributeBalance>
<balance>
<stockOnHand>0</stockOnHand>
<committed>0</committed>
<available>60</available>
<receiving>0</receiving>
<damaged>0</damaged>
<onHold>0</onHold>
<reserved>0</reserved>
<restricted>0</restricted>
<availableToOrder>20</availableToOrder>
<held>0</held>
<enteredStock>0</enteredStock>
</balance>
<attributes>
<attribute>
<attributeType>Grade1</attributeType>
<value>1</value>
</attribute>
<attribute>
<attributeType>Grade2</attributeType>
<value />
</attribute>
<attribute>
<attributeType>Grade3</attributeType>
<value />
</attribute>
<attribute>
<attributeType>ArrivalDate</attributeType>
<value>2017-10-13T12:38:00.237</value>
</attribute>
<attribute>
<attributeType>ExpiryDate</attributeType>
<value>2017-10-01</value>
</attribute>
<attribute>
<attributeType>PackingDate</attributeType>
<value>1900-01-01</value>
</attribute>
</attributes>
</attributeBalance>
<attributeBalance>
<balance>
<stockOnHand>0</stockOnHand>
<committed>0</committed>
<available>40</available>
<receiving>0</receiving>
<damaged>0</damaged>
<onHold>0</onHold>
<reserved>0</reserved>
<restricted>0</restricted>
<availableToOrder>10</availableToOrder>
<held>0</held>
<enteredStock>0</enteredStock>
</balance>
<attributes>
<attribute>
<attributeType>Grade1</attributeType>
<value>22</value>
</attribute>
<attribute>
<attributeType>Grade2</attributeType>
<value />
</attribute>
<attribute>
<attributeType>Grade3</attributeType>
<value />
</attribute>
<attribute>
<attributeType>ArrivalDate</attributeType>
<value>2015-09-23T22:35:34.730</value>
</attribute>
<attribute>
<attributeType>ExpiryDate</attributeType>
<value>2015-12-12</value>
</attribute>
<attribute>
<attributeType>PackingDate</attributeType>
<value>1900-01-01</value>
</attribute>
</attributes>
</attributeBalance>
</attributeBalances>
</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.