question

retroam avatar image
retroam asked retroam commented

Update stockCount

Is it possible to update the stock count of an inventory item? Can't find a decent example of how to do this.

Inventory
10 |2000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

Jacob Abrams avatar image
Jacob Abrams answered retroam commented

Yes it is possible to update the stock count. I don't know if you are trying to do this using the web REST API or the android SDK. With the web REST API take a look at /v3/merchants/{mId}/item_stocks/{itemId}in the docs https://www.clover.com/api_docs#!/inv... . For Android look at InventoryConnector#updateItemStockat https://github.com/clover/clover-andr... .

With the REST API here is an example of the JSON you would use, for some reason it is not documentated correctly on the website:

{
    "elements": [
        {
            "item" : { "id" : "YKRTKCK2WY83Y" },
            "stockCount" : 7
        },
        {
            "item" : { "id" : "NAK8TWEX1G8YT" },
            "stockCount" : 8
        }
    ]
}
4 comments
10 |2000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

retroam avatar image retroam commented ·

Thanks for the tip! I am using the web REST API. The documentation is a little unclear on what parameters need to be passed (just tested {quantity: x} which didn't work).

0 Likes 0 ·
Jacob Abrams avatar image Jacob Abrams ♦♦ commented ·

I updated the answer with an example of the JSON.

0 Likes 0 ·
retroam avatar image retroam commented ·

great, thanks...will give that shot

0 Likes 0 ·
retroam avatar image retroam commented ·

Is there a cURL example I can use...I have been trying to get the following to work (based of https://docs.clover.com/build/web-app...) : url -s -X POST "https://api.clover.com/v3/merchants/[merchat id]/item_stocks/[item id]" --header "Authorization: Bearer [access token]" --data "{"item": {"id": "[item id]"},"quantity": 50}" | python -mjson.tool

Keep getting: { "message": "Unable to read Form request data. Did you mean to use the application/json content type?" }

0 Likes 0 ·

Welcome to the
Clover Developer Community