cancel
Showing results for 
Search instead for 
Did you mean: 

Magento2 REST API with XML data is not working during inventory API

Magento2 REST API with XML data is not working during inventory API

I am building an application which is using Magento REST API for exchanging data and I am using XML for transferring data. But during posting data in XML format I am getting an error "stock item field is required".For inventory upload I am using PUT method and URL for hitting API is like this.

http://myhost.com/Individual/XXX/magento2/index.php/rest/V1/products/Stock/stockItems/2

and XML data I am sending is below

 

<stockItem>
    <itemId>2</itemId>
    <productId>2</productId>
    <qty>10</qty>
    <isInStock>true</isInStock>
    <isQtyDecimal>true</isQtyDecimal>
    <showDefaultNotificationMessage>true</showDefaultNotificationMessage>
    <useConfigMinQty>true</useConfigMinQty>
    <minQty>0</minQty>
    <useConfigMinSaleQty>0</useConfigMinSaleQty>
    <minSaleQty>0</minSaleQty>
    <useConfigMaxSaleQty>true</useConfigMaxSaleQty>
    <maxSaleQty>0</maxSaleQty>
    <useConfigBackorders>true</useConfigBackorders>
    <backorders>0</backorders>
    <useConfigNotifyStockQty>true</useConfigNotifyStockQty>
    <notifyStockQty>0</notifyStockQty>
    <useConfigQtyIncrements>true</useConfigQtyIncrements>
    <qtyIncrements>0</qtyIncrements>
    <useConfigEnableQtyInc>true</useConfigEnableQtyInc>
    <enableQtyIncrements>true</enableQtyIncrements>
    <useConfigManageStock>true</useConfigManageStock>
    <manageStock>true</manageStock>
    <lowStockDate></lowStockDate>
    <isDecimalDivided>true</isDecimalDivided>
    <stockStatusChangedAuto>0</stockStatusChangedAuto>
</stockItem>