question

tsultana avatar image
tsultana asked zgreathouse Deactivated commented

Problem with item stock api response

Sometimes we make api calls to: /v3/merchants/merchant_id/item_stocks/

However the response we get is missing the quantity. Most responses work but some dont. Here is a standard response we get:
{ 	"item": {"id": "FCJM44EZ2TPEA"}, 
	"stockCount": 98, 
	"quantity": 98.0, 
	"modifiedTime": 1550093952000
}
however sometimes we get:
{
	"item": {"id": "BYJJK4CADYGST"}
}

I believe this occurred on the 13th Feb at 10:39pm GMT +1.

As you can see the products are different IDs, however id like to know why the second response did not return a stock.
REST API
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.

chanel avatar image chanel commented ·

In order to provide a a complete answer, I'll need a clearer picture of how you're making the calls.

How are your making the calls (please provide a code snippet)?
Can you provide the exact timestamp of both calls?
Were the two calls to the same merchant?

0 Likes 0 ·
tsultana avatar image tsultana commented ·

Hi the code used is the same for both calls, majority of the time i get a good response but rarely ill get a bad response (missing quantity).

The bad response came in at Wed, Feb 13, 10:39 PM GMT+1. The good response came in at the same time.

Yes the calls where done to the same merchant. Do you need the merchant id?

0 Likes 0 ·
tsultana avatar image tsultana commented ·
Any ideas?
0 Likes 0 ·
tsultana avatar image tsultana commented ·
Please check this clover id YMDRSG7V2PRBE. It never returns item stock.
0 Likes 0 ·
zgreathouse avatar image
zgreathouse Deactivated answered zgreathouse Deactivated edited
Items which have no Stock Count set will not show a stock count. From the Merchant Dashboard you can go the the Inventory Tab and navigate to "stock." Here you can see the stock count of all your items. The item which is never returning a count should also not have a value in the "Stock Quantity" field.

Using the following image as an example:


When checking the stock for Black Bags using the API you will get the following response:
{
    "item": {
        "id": "*************"
    }
}

When checking the stock for Grey Bags using the API you will get the following response:
{
    "item": {
        "id": "*************"
    },
    "stockCount": 9999,
    "quantity": 9999,
    "modifiedTime": 1552506425000
}

example.png (78.7 KiB)
10 |2000

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

tsultana avatar image
tsultana answered zgreathouse Deactivated commented
Thanks for the helpful reply! i wasn't aware that an empty value caused that. Thanks for the assistance.
1 comment
10 |2000

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

zgreathouse avatar image zgreathouse commented ·

Not a problem- thank you for your question! Let us know if you run into anything else.

0 Likes 0 ·

Welcome to the
Clover Developer Community