Add Bulk Product Inventory
Use this operation to add Inventory to an existing Products object.
Parameters
Body Params | |
---|---|
JSON: | json |
XML: | string |
Path Params | |
---|---|
yourCompany: | string |
callback_url | string |
sendRecordNo | string
|
Header Params | |
---|---|
Accept: | string |
Query Auth | |
---|---|
key: | string |
Header Auth | |
---|---|
apiKey: | string |
Sample Code
{
"ProductInventory": {
"StockLocationInventory": [
{
"ProductCode": "ProductCode1",
"StockLocation": "OAK",
"QtyInStock": "51",
"UnitCost": "14",
"QtyOnPO": "10",
"QtyOnSO": "20",
"BinLocation": "Test Bin2"
},
{
"ProductCode": "ProductCode2",
"StockLocation": "SAN",
"QtyInStock": "52",
"UnitCost": "14",
"QtyOnPO": "20",
"QtyOnSO": "30",
"BinLocation": "Test Bin2"
}
]
}
}
<ProductInventory>
<StockLocationInventory>
<ProductCode>ProductCode1</ProductCode>
<StockLocation>OAK</StockLocation>
<QtyInStock>51</QtyInStock>
<UnitCost>14</UnitCost>
<QtyOnPO>10</QtyOnPO>
<QtyOnSO>20</QtyOnSO>
<BinLocation>Test Bin2</BinLocation>
</StockLocationInventory>
<StockLocationInventory>
<ProductCode>ProductCode2</ProductCode>
<StockLocation>SAN</StockLocation>
<QtyInStock>52</QtyInStock>
<UnitCost>14</UnitCost>
<QtyOnPO>20</QtyOnPO>
<QtyOnSO>30</QtyOnSO>
<BinLocation>Test Bin2</BinLocation>
</StockLocationInventory>
</ProductInventory>
Sample Response
{
"MCM": {
"response": {
"objectType": "Products",
"syncTime": "2021-06-11 04:13:24"
},
"parameters": {
"results": {
"message": {
"status": "Success",
"success_message": "Bulk Product Inventory Initiated Successfully.",
"batch_id": "thggii1212kjkl"
}
}
}
}
}
<MCM>
<response>
<objectType>Products</objectType>
<syncTime>2021-06-11 04:13:24</syncTime>
</response>
<parameters>
<results>
<message>
<status>Success</status>
<success_message> Bulk Product Inventory Initiated Successfully. </success_message>
<batch_id>thggii1212kjkl</batch_id>
</message>
</results>
</parameters>
</MCM>
WADL
<?xml version="1.0" encoding="utf-8"?>
<application>
<resources base="https://{yourCompany}.agiliron.net/agiliron/api-40/">
<resource path="Bulk-ProductsInventory">
<method name="POST">
<request>
<param name="key" type="xsd:string" style="query" required="true"/>
<param name="ProductCode" type="xsd:string" style="body" required="true"/>
<param name="StockLocation" type="xsd:string" style="body" required="true"/>
<param name="QtyInStock" type="xsd:string" style="body"/>
<param name="UnitCost" type="xsd:decimal" style="body"/>
<param name="QtyOnPO" type="xsd:int" style="body"/>
<param name="QtyOnSO" type="xsd:int" style="body"/>
<param name="BinLocation" type="xsd:string" style="body"/>
</request>
<response status="200">
<representation mediaType="application/xml" element="yn:ResultSet"/>
</response>
<response status="400">
<representation mediaType="application/xml" element="ya:Error"/>
</response>
</method>
</resource>
</resources>
</application>
Sample Webhook
<?php
$url = "https://{your_custom_url}"; //this custom url will be called after the code is executed
$curlConn = curl_init();
curl_setopt($curlConn, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($curlConn, CURLOPT_POSTFIELDS,$results); //$results contain the result set
curl_setopt($curlConn,CURLOPT_URL,$url);
curl_setopt($curlConn, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($curlConn, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($curlConn, CURLOPT_RETURNTRANSFER, 1);
$ret = curl_exec($curlConn);
?>
<result>
<SuccessNumber>1</SuccessNumber>
<FailureNumber>1</FailureNumber>
<Success>
<ProductInventory>
<ProductCode>TNP1234</ProductCode>
<StockLocation>OAK</StockLocation>
<Quantity>20</Quantity>
</ProductInventory>
</Success>
<Failure>
<ProductInventory>
<ProductCode>TNP123</ProductCode>
<StockLocation>FBA</StockLocation>
<Message>Invalid Stock Location</Message>
</ProductInventory>
</Failure>
</result>
{
"result": {
"SuccessNumber": "1",
"FailureNumber": "1",
"Success": {
"ProductInventory": {
"ProductCode": "TNP1234",
"StockLocation": "OAK",
"Quantity": "20"
}
},
"Failure": {
"ProductInventory": {
"ProductCode": "TNP123",
"StockLocation": "FBA",
"Message": "Invalid Stock Location"
}
}
}
}
<result>
<SuccessNumber>1</SuccessNumber>
<FailureNumber>1</FailureNumber>
<Success>
<ProductInventory>
<ProductCode>TNP1234</ProductCode>
<StockLocation>OAK</StockLocation>
<Quantity>20</Quantity>
<Record>1</Record>
</ProductInventory>
</Success>
<Failure>
<ProductInventory>
<ProductCode>TNP123</ProductCode>
<StockLocation>FBA</StockLocation>
<Message>Invalid Stock Location</Message>
<Record>2</Record>
</ProductInventory>
</Failure>
</result>
{
"result": {
"SuccessNumber": "1",
"FailureNumber": "1",
"Success": {
"ProductInventory": {
"ProductCode": "TNP1234",
"StockLocation": "OAK",
"Quantity": "20",
"Record": "1"
}
},
"Failure": {
"ProductInventory": {
"ProductCode": "TNP123",
"StockLocation": "FBA",
"Message": "Invalid Stock Location",
"Record": "2"
}
}
}
}
Updated about 21 hours ago