question

efriese avatar image
efriese asked efriese commented

Getting Number of Items per Day by Label

I'm looking to use the Clover API to pull the number of items purchased per day based on a label. I run a coffee shop and I have created a "Drink" label I attach to every item that is a coffee drink. I was hoping there was a better way to use the API to pull this information besides pull all of the orders and then getting each order and then each item. Is there an endpoint like /labels?label=foo&createdTime>UTC? If not any guidance on the best way to do this would be appreciated.

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.

efriese avatar image efriese commented ·

Since no answers yet, can I ask the dev guys for an enhancement? When I query /orders and expand on lineItems could you also include the labels associated with the line item? That would allow me to count based on Labels by just querying orders.

0 Likes 0 ·
voski avatar image voski commented ·

Is this something that you could get the the Items report in the Reporting web app?

Reporting > Items tab then select group by Label.

0 Likes 0 ·
efriese avatar image efriese commented ·

Yes but I would like to automate the process. I want to do historical analysis of total items by label and I don't have the way to do that via reporting. I would have to run a report every day and manually store the number.

I tried to query the reporting web page, but it didn't return JSON. Scraping that site would be difficult, so I was hoping to get this through the API.

0 Likes 0 ·
efriese avatar image efriese commented ·

This will work for just counting one dimension, but the API capabilities for labels is still lacking. I'm able to count the number of product codes, but if an item has more than one label I can't do analysis of both of them. This will work for now, but it limits what I want to do. Thanks for the suggestion!

0 Likes 0 ·
sam avatar image
sam Deactivated answered

If you're not already using Product Code for anything, you could use it as a "label" for relevant items. This will give you the necessary information when requesting order API with expanded lineitems.

https://apisandbox.dev.clover.com/v3/merchants/{merchantid}/orders?expand=lineItems

10 |2000

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

billy-watkins avatar image
billy-watkins answered

just saw this, I think labels in the api are retrieved using tags and not labels so it would be expand=lineitem.item.tags

10 |2000

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

Welcome to the
Clover Developer Community