Item Quantity Update using API

234 views
Skip to first unread message

foysal foysal

unread,
Oct 12, 2015, 9:00:25 AM10/12/15
to merchantos-a...@googlegroups.com
I am trying to Item Quantity Update using API. I am getting below error. 

object(SimpleXMLElement)#284 (4) {
  ["httpCode"]=>
  string(3) "400"
  ["httpMessage"]=>
  string(11) "Bad Request"
  ["message"]=>
  string(85) "Item not Update. The ItemShop record with shopID 0 cannot have its qoh field changed."
  ["errorClass"]=>
  string(9) "Exception"
}

My Script is working previously but right now it is giving this error. Can anyone say where is the problem ??

Thanks

JohnO

unread,
Oct 12, 2015, 5:00:48 PM10/12/15
to Lightspeed Retail API Developers
Hey Foysal,

ItemShop Id 0 is read-only and is reserved to aggregate quantities across all of your "Shops".  To update QOH you must specify the proper ShopId for the "shop" you wish to update.

Best,
John

foysal foysal

unread,
Oct 13, 2015, 2:28:58 AM10/13/15
to merchantos-a...@googlegroups.com
Thanks John for your valuable reply. My script was working previously but right now its not working. How can I specify proper ShopId ?? Could you please provide some sample codes ??

I am using below code to Update item QOH through API.


$mos = new MOSAPI\MOSAPICall($this->_apikey, $this->_userid);
            $xml_update_item_stock = "<?xml version='1.0'?><Item><ItemShops><ItemShop><qoh>" . $quantity_to_update . "</qoh></ItemShop></ItemShops></Item>";
            $updated_item_response_xml = $mos->makeAPICall("Account.Item", "Update", $item_id, $xml_update_item_stock) or die(err_msg);
            return $updated_item_response_xml;



Thanks

Foysal


--
You received this message because you are subscribed to the Google Groups "Lightspeed Retail API Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to merchantos-api-dev...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

JohnO

unread,
Oct 13, 2015, 5:30:36 PM10/13/15
to Lightspeed Retail API Developers
Foysal,

The API documentation is great for figuring things like this out.  You can find it here: http://cloud-docs.lightspeedapp.com/API/APIHelp.help

To find the proper ShopID, you can use the /API/Account/{accountID}/Shop API Call too see all shops on your account.

Just wondering, are you using the API to decrement inventory for sales outside of LightSpeed?  If so, your best route is probably to create a sale through the API so you can decrement inventory as well as push through prices.

Best,
John
To unsubscribe from this group and stop receiving emails from it, send an email to merchantos-api-developers+unsub...@googlegroups.com.

foysal foysal

unread,
Oct 14, 2015, 4:12:55 AM10/14/15
to merchantos-a...@googlegroups.com
John you did a great help for me. Thanks a lot. 

To unsubscribe from this group and stop receiving emails from it, send an email to merchantos-api-dev...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Lightspeed Retail API Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to merchantos-api-dev...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages