Search Orders response has no usable ID for line_items

As per the title, when I Search Orders, the response that come back has no ID that can be matched up to an item. The only two things that it has are uid, and catalog_object_id, neither of which are a part of an item. I have searched every part of an order response and an item response and there is no way to match them up.

The only way it seems to be possible is by using the name of the item, which is just a really stupid thing to have to do. Is there anyway to do this or is the API just broken?

The catalog_object_id is the id for the Catalog API. If you were to use that id and pass it to RetrieveCatalogObject, for instance, it would return the item/variation/modifier/etc. What do you mean that it can’t be matched up to an item?

So, does this mean that an Item is a CatalogObject? So the catalog contains a list of all of the items (CatalogObjects)? If that is they case then what is the inventory? I’m sorry, the docs just seem very unclear to me on what the Catalog/Inventory are.

Also, when I do “” and get some orders, there is no catalog_object_id for the items. I need to be able to match up items(CatalogObjects?) with the items sold in orders. Basically to find all of the items in the orders and match them the items that the seller has.

The catalog consists of everything: items, variations, modifiers, taxes, discounts, etc. It knows if a particular variation has inventory tracking turned on, but does not know what the actual inventory is. There is a separate Inventory API that returns that information.

If an order has an item, but no catalog_object_id, then most likely it was an ad-hoc item, meaning it doesn’t exist in the Square catalog library. You are definitely free to use ad-hoc items in your order, but you won’t be able to match them up to items in your library of course since there’s no ids. Feel free to provide an example order_id and I can take a look to confirm, though.

Ok, so, how can I create items that are stored in the catalog and are not ad-hoc items? In the developer dashboard I click on “Create an Item” and then fill in all of the information, there is nothing about catalogs or anything to suggest how to make a non-ad-hoc item.

Also, do the users of square generally have everything in the catalog or do they mostly create ad-hoc items? Seems a big mistake for it to be so easy to create items that have no catalog_object_id on them, and therefore no way to actually identify them.

Also, I misspoke. When I search orders and get back a list of orders, there is a catalog_object_id for each item sold in each order.

However, when I get a list of all items from “connect. squareup .com/v2/catalog/search” the result that I get from that contains no catalog_object_id anywhere. I have searched through each part of the resulting object and I can find no catalog_object_id for any of the items.

Ok let’s take a step back cause there’s some confusion happening here. All catalog-created items will have an id (not be ad-hoc: ad-hoc literally means it doesn’t exist in your Square Catalog).

When searching your catalog, you will not see catalog_object_id, you’ll see id (because it’s the id of the catalog object). So, when you retrieve an order, and see a catalog_object_id, that will be equivalent to searching the Catalog API and finding the id. You can also just call RetrieveCatalogObject with the catalog_object_id as the argument.

So, to clarify, the Orders catalog_object_id is equivalent to the Catalogs id. The catalog_object_id is referencing a Catalog object id directly (which is what the Catalog API returns). Let me know if you still have questions around this, though.

1 Like

Hey, great. That all makes sense now. Would probably be useful in the future to have a kind of 30,000 foot overview of how things are set up. Each individual element (orders, catalog, inventory, items, etc.) are only explained in regards to themselves as far as I can tell and it seems kind of hard to figure out how it all works together. Or maybe I’m just an idiot, who knows. Either way, thanks a lot for your help, I really appreciate.

Also, the Search Orders “response Json” detailed on this page: is not even remotely similar to the results that I recieve. If you want an example from me, just let me know.

1 Like

Lee - The Response JSON they are showing by default is when request specifies return_entries = TRUE (I’m not sure why they do that when the default is FALSE). That said, to see the Response JSON for a call when return_entries is omitted or FALSE, scroll down on that page to Response Fields and click “Show Attributes” next to Orders (Order[ ]).

1 Like

I’d also point out that the catalog_object_id you get in the list of items on the order is actually for the Item Variation not the Item. If you want to get the Item entry from the catalog you will need to set the include_related_objects flag on the retrieveCatalogObj query to get the actual Item entry returned as well. Or, you could make a 2nd call to retrieveCatalogObj using the item_id from the initial call to the Item Variation.