Retrieve Catalog Objects

Applies to: Catalog API

Learn how to retrieve catalog objects by calling the ListCatalog, RetrieveCatalogObject, or BatchRetrieveCatalogObjects endpoint.

Link to section

Retrieve catalog objects without specifying IDs

If you want to retrieve a catalog object but don't know its ID, ListCatalog returns a (paged) list of all objects created up to the point of the call. You can then inspect and select one.

As new objects are added to the catalog or changes are made to the exiting objects, the affected objects are assigned new versions. In a sense, versions are historical markers of objects in a catalog. Throughout the lifecycle of a catalog, a catalog version represents a snapshot of the catalog at a particular time. The snapshot includes objects created or updated up to the specified version number. The included objects are of either the specified or lesser version.

By specifying a catalog version as an input to the ListCatalog endpoint, you can determine all changes made at a particular point of time throughout the history of the catalog.

When a call to the ListCatalog endpoint is expected to return a large set of objects, you might need to use pagination to retrieve the results page by page.

Link to section

Request: List catalog objects of any version

The following cURL example returns all the objects of any version in a (small) catalog:

List catalog

Link to section

Response: List catalog objects of any version

Link to section

Request: List catalog objects at a specific catalog version

To inspect what is added to or changed in the catalog, you can call ListCatalog with a specific catalog version as a query parameter to get only those objects of the specified version as well as those of lesser versions.

The following cURL example returns CatalogItem objects at the catalog version of 1598467546497:

List catalog

The results include only objects created or updated up to the particular point of time corresponding to the specified catalog version.

Link to section

Response: List catalog objects at a specific catalog version

Link to section

Retrieve a catalog object with a specified ID and catalog version

If you have the ID of an object, RetrieveCatalogObject lets you return the specified catalog object. If the object has multiple versions (that is, they're created or updated at different times), you can specify a catalog version to narrow the selection to the specified point of time.

The following cURL example retrieves a catalog object of the ID (QZEQSRNMTCXWXQD2QLEVCSRA) and version (1598396203556):

Link to section

Request: Retrieve a catalog object with a specified ID and at a specified catalog version

Retrieve catalog object

Link to section

Response: Retrieve a catalog object with a specified ID and at a specified catalog version

Link to section

Retrieve multiple catalog objects with specified IDs and at a specified catalog version

If you have multiple object IDs, BatchRetrieveCatalogObjects lets you return the specified objects in a single call. If the objects have multiple versions, you can specify a version to filter the results.

Link to section

Request: Batch retrieving catalog objects with specified IDs and at a specified catalog version

The following cURL request shows how to retrieve two items (3KZ5V3SFVKGRCFQZI6JIMGVW and QZEQSRNMTCXWXQD2QLEVCSRA) at the catalog version of 1598467546497:

Batch retrieve catalog objects

Link to section

Response: Batch retrieving catalog objects of specified IDs and at a specified catalog version

The response includes specified objects created or updated up to the specified catalog version of 1598467546497:

Link to section

Retrieve a catalog object and its referenced objects

In a Square catalog, an object references other objects by their IDs. To retrieve the referenced objects with their properties, set the include_related_objects query parameter to true when calling RetrieveCatalogObject or its batch variant.

For example, a CatalogPricingRule object can reference a CatalogDiscount, CatalogProductSet, CatalogTax, and others. When calling RetrieveCatalogObject specifying the ID of a pricing rule object and using defaults for all other input options, you get a compact result as follows:

By explicitly setting include_related_objects to true, as shown in the following example:

Link to section

Request

Retrieve catalog object

You get the following results with detailed information about the (recursively) referenced objects.

Link to section

Response