Querying inventory
The quantity
field holds an item’s stock and is found by expanding itemStock
when viewing items. This field can only be updated through item_stocks
endpoints. The field supports whole or decimal numbers, both positive and negative.
$ curl -s "https://apisandbox.dev.clover.com/v3/merchants/{mId}/item_stocks/{Item_ID}" --header "Authorization: Bearer {API_Token}" | python -mjson.tool
{
"item": {
"id": "3Z29BX6C013XC"
},
"stockCount": 127,
"quantity": 127
}
stockCount
is a deprecated field that will always display quantity
rounded to the nearest whole number. As a result, its use is discouraged. The following example shows how a decimal quantity value of 160.5
is rounded to 161
for the stockCount
field.
$ cat /tmp/item_stocks.json
{
"quantity": 160.5
}
$ curl -s -X POST "https://apisandbox.dev.clover.com/v3/merchants/{mId}/item_stocks/{Item_ID}" --header "Authorization: Bearer {API_Token}" --data "{Content from item_stocks.json}" | python -mjson.tool
{
"item": {
"id": "3Z29BX6C013XC"
},
"stockCount": 161,
"quantity": 160.5
}
Updated over 2 years ago
Did this page help you?