question

zedwick avatar image
zedwick asked zedwick commented

Getting conflicting information related to categories

I use the category of an item to track it's sale. Since the Clover inventory does not reliably alert me when an item's category has been changed, I wrote a work around to check the category of an item at the time of sale. It's a little more load on your system, but I need this information to be accurate. This is all done against the v3 API

So, at the time of sale, I will ask a question like this:

v3/merchants/QSNPDHZQDSP7C/items/6VRPDFAM99QJE/categories?limit=100

I will usually get an answer that looks correct, and it has some categories sometimes, or at least it used to. Now I'm seeing answers like this, so I ignore the sale. Is the problem that the categories command is responding with the "tags" response?

{
  ["elements"]=>
  array(0) {
  }
  ["href"]=>
  string(83) "http://api.clover.com/v3/merchants/QSNPDHZQDSP7C/items/6VRPDFAM99QJE/tags?limit=100"
}

Now I find out that my reports are wrong! So I double check, and the customer swears there are categories are right. How can this be? So, I try it from another angle, and ask the following question of the API. R0HYVQMV5PWPG is the ID of the category that the customer says is attached to this item.

v3/merchants/QSNPDHZQDSP7C/categories/R0HYVQMV5PWPG/items

And in reply, I get 43 items. I cut most of them out, but the last one I find very interesting.

{
  ["elements"]=>
  array(43) {
 ....
    [42]=>
    object(stdClass)#48 (14) {
      ["id"]=>
      string(13) "6VRPDFAM99QJE"
      ["hidden"]=>
      bool(false)
      ["name"]=>
      string(25) "Blue Leather Swivel Chair"
      ["alternateName"]=>
      string(0) ""
      ["code"]=>
      string(12) "210842175006"
      ["sku"]=>
      string(0) ""
      ["price"]=>
      int(7500)
      ["priceType"]=>
      string(5) "FIXED"
      ["defaultTaxRates"]=>
      bool(true)
      ["unitName"]=>
      string(0) ""
      ["cost"]=>
      int(0)
      ["isRevenue"]=>
      bool(true)
      ["stockCount"]=>
      int(0)
      ["modifiedTime"]=>
      int(1456934649000)
    }
  }
  ["href"]=>
  string(89) "http://api.clover.com/v3/merchants/QSNPDHZQDSP7C/categories/R0HYVQMV5PWPG/items?limit=100"
}

There, my item is listed as being attached to the category! So, now I'm off to write another work around. Despite all the attitude in my post, I fully accept that I might be doing something wrong, and if that's the case, I would sure appreciate some help.

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

jim-patel avatar image
jim-patel answered zedwick commented

The first example for field expansion uses expanding categories for an item as an example. I believe this might address your issue.

3 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.

zedwick avatar image zedwick commented ·

That seems to work as a viable work around. Is the documentation out of date or is the request method I'm using just broken?

0 Likes 0 ·
Mike M avatar image Mike M commented ·

The /tag portion of the href in the returned API call is actually a bug, however in looking at the code, it does not actually affect the request's response. I will file a ticket to get that fixed though.

I unfortunately am unable to reproduce your issue though. How often are you seeing the v3/merchants/{mId}/items/{itemId}/categories not return the correct response?

0 Likes 0 ·
Mike M avatar image Mike M commented ·

In regards to webhooks, items do not "own" categories, so the item-category association is actually agnostic of the item's model in our database, which is what the inventory webhook currently "monitors". That's why there is an API specifically for item-category associations: https://www.clover.com/api_docs#!/inv...

0 Likes 0 ·

Welcome to the
Clover Developer Community