How to distinguish "reporting category" from normal categories in the API?

What is the correct way to determine whether a category is a “reporting category” vs a normal category?

Here is an example product, which is assigned the category “Baked Goodness”, and has a reporting category of “Pastries”:

Here is how these two categories are retrieved in the API:

Baked Goodness (“normal” category):

    {
      "category_data": {
        "category_type": "REGULAR_CATEGORY",
        "is_top_level": true,
        "name": "Baked Goodness",
        "online_visibility": true,
        "parent_category": {
          "ordinal": -2251662374731776
        }
      },
      "created_at": "2024-03-29T16:40:17.392Z",
      "id": "GBWQJWRRB5QFO7CJ75ROXA5W",
      "is_deleted": false,
      "present_at_all_locations": true,
      "type": "CATEGORY",
      "updated_at": "2024-03-29T16:40:17.392Z",
      "version": 1711730417392
    }

Pastries (reporting category):

    {
      "category_data": {
        "category_type": "REGULAR_CATEGORY",
        "is_top_level": true,
        "name": "Pastries",
        "online_visibility": true
      },
      "created_at": "2020-08-22T18:23:51.05Z",
      "id": "HOIWOAPTYHLGBNA6SIWXGH3A",
      "is_deleted": false,
      "present_at_all_locations": true,
      "type": "CATEGORY",
      "updated_at": "2022-10-19T19:37:39.34Z",
      "version": 1666208259340
    }

We don’t see much to distinguish them, in particular:

  • both have .type == "CATEGORY"
  • both have .category_data.category_type == "REGULAR_CATEGORY"

The only difference seems to be that the “normal” category has a .category_data.parent_category.ordinal field. It seems like that could be a difference, but we don’t know why (& it feels brittle).

What’s the right way to determine that a category is the reporting category of an item? Thanks!

Are these categories that were created for the Online Store? What page was that screenshot take? :slightly_smiling_face:

The screenshot is from our sandbox test account in the “Items” section/editor. Specifically the URL is:

https://squareupsandbox.com/dashboard/items/library/D3JNPMN4WI6QHXJRGKIPZR7Z

I am unfortunately not sure when/why the categories were created.

What’s your application ID? :slightly_smiling_face:

Sandbox application ID: sandbox-sq0idb-FonlJujwTt_Iz5rZ9Yqhdw

At this time the reporting_category on the catalog object is what you’ll use to identify what category is configured as the reporting category in the Dashboard. :slightly_smiling_face:

Thanks Bryan. There still seems to be something squirrely with this. Perhaps our sandbox account is corrupt?

Here is a product which is shown as belonging to the “Beverages” category, and has no separate reporting category listed.

https://squareupsandbox.com/dashboard/items/library/OS6SAGW6GMLVOHQY5IMXRTSR

However, “Beverages” not appear in the pop up category selector. Maybe because it is a reporting category.

So it seems like these products are stuck with a reporting category as a “normal” category, and we can’t remove it.

(We also noticed that products which have a reporting category declared, show that category both under “Categories” and “Reporting category”. You can see an example of this in my original screenshot.)