0

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.

asked 2016-03-03 21:14:44 -0500

Zedwick gravatar image

updated 2016-03-03 22:34:41 -0500

1 answer

Sort by  
0

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

answered 2016-03-04 10:08:00 -0500

Jim Patel gravatar image
Comments

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?

Zedwick gravatar image
Zedwick 2016-03-04 10:16:13 -0500

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?

mike gravatar image
mike 2016-03-04 12:09:04 -0500

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

mike gravatar image
mike 2016-03-04 12:09:30 -0500