Skip to content

Latest commit

 

History

History
83 lines (70 loc) · 11.5 KB

catalog-object.md

File metadata and controls

83 lines (70 loc) · 11.5 KB

Catalog Object

The wrapper object for the catalog entries of a given object type.

Depending on the type attribute value, a CatalogObject instance assumes a type-specific data to yield the corresponding type of catalog object.

For example, if type=ITEM, the CatalogObject instance must have the ITEM-specific data set on the item_data attribute. The resulting CatalogObject instance is also a CatalogItem instance.

In general, if type=<OBJECT_TYPE>, the CatalogObject instance must have the <OBJECT_TYPE>-specific data set on the <object_type>_data attribute. The resulting CatalogObject instance is also a Catalog<ObjectType> instance.

For a more detailed discussion of the Catalog data model, please see the Design a Catalog guide.

Structure

CatalogObject

Fields

Name Type Tags Description
type string Required Possible types of CatalogObjects returned from the catalog, each
containing type-specific properties in the *_data field corresponding to the specfied object type.
id string Required An identifier to reference this object in the catalog. When a new CatalogObject
is inserted, the client should set the id to a temporary identifier starting with
a "#" character. Other objects being inserted or updated within the same request
may use this identifier to refer to the new object.

When the server receives the new object, it will supply a unique identifier that
replaces the temporary identifier for all future references.
Constraints: Minimum Length: 1
updatedAt string | undefined Optional Last modification timestamp in RFC 3339 format, e.g., "2016-08-15T23:59:33.123Z"
would indicate the UTC time (denoted by Z) of August 15, 2016 at 23:59:33 and 123 milliseconds.
version bigint | undefined Optional The version of the object. When updating an object, the version supplied
must match the version in the database, otherwise the write will be rejected as conflicting.
isDeleted boolean | undefined Optional If true, the object has been deleted from the database. Must be false for new objects
being inserted. When deleted, the updated_at field will equal the deletion time.
customAttributeValues Record<string, CatalogCustomAttributeValue> | undefined Optional A map (key-value pairs) of application-defined custom attribute values. The value of a key-value pair
is a CatalogCustomAttributeValue object. The key is the key attribute
value defined in the associated CatalogCustomAttributeDefinition
object defined by the application making the request.

If the CatalogCustomAttributeDefinition object is
defined by another application, the CatalogCustomAttributeDefinition's key attribute value is prefixed by
the defining application ID. For example, if the CatalogCustomAttributeDefinition has a key attribute of
"cocoa_brand" and the defining application ID is "abcd1234", the key in the map is "abcd1234:cocoa_brand"
if the application making the request is different from the application defining the custom attribute definition.
Otherwise, the key used in the map is simply "cocoa_brand".

Application-defined custom attributes are set at a global (location-independent) level.
Custom attribute values are intended to store additional information about a catalog object
or associations with an entity in another system. Do not use custom attributes
to store any sensitive information (personally identifiable information, card details, etc.).
catalogV1Ids CatalogV1Id[] | undefined Optional The Connect v1 IDs for this object at each location where it is present, where they
differ from the object's Connect V2 ID. The field will only be present for objects that
have been created or modified by legacy APIs.
presentAtAllLocations boolean | undefined Optional If true, this object is present at all locations (including future locations), except where specified in
the absent_at_location_ids field. If false, this object is not present at any locations (including future locations),
except where specified in the present_at_location_ids field. If not specified, defaults to true.
presentAtLocationIds string[] | undefined Optional A list of locations where the object is present, even if present_at_all_locations is false.
This can include locations that are deactivated.
absentAtLocationIds string[] | undefined Optional A list of locations where the object is not present, even if present_at_all_locations is true.
This can include locations that are deactivated.
itemData CatalogItem | undefined Optional A CatalogObject instance of the ITEM type, also referred to as an item, in the catalog.
categoryData CatalogCategory | undefined Optional A category to which a CatalogItem instance belongs.
itemVariationData CatalogItemVariation | undefined Optional An item variation, representing a product for sale, in the Catalog object model. Each item must have at least one
item variation and can have at most 250 item variations.

An item variation can be sellable, stockable, or both if it has a unit of measure for its count for the sold number of the variation, the stocked
number of the variation, or both. For example, when a variation representing wine is stocked and sold by the bottle, the variation is both
stockable and sellable. But when a variation of the wine is sold by the glass, the sold units cannot be used as a measure of the stocked units. This by-the-glass
variation is sellable, but not stockable. To accurately keep track of the wine's inventory count at any time, the sellable count must be
converted to stockable count. Typically, the seller defines this unit conversion. For example, 1 bottle equals 5 glasses. The Square API exposes
the stockable_conversion property on the variation to specify the conversion. Thus, when two glasses of the wine are sold, the sellable count
decreases by 2, and the stockable count automatically decreases by 0.4 bottle according to the conversion.
taxData CatalogTax | undefined Optional A tax applicable to an item.
discountData CatalogDiscount | undefined Optional A discount applicable to items.
modifierListData CatalogModifierList | undefined Optional A list of modifiers applicable to items at the time of sale.

For example, a "Condiments" modifier list applicable to a "Hot Dog" item
may contain "Ketchup", "Mustard", and "Relish" modifiers.
Use the selection_type field to specify whether or not multiple selections from
the modifier list are allowed.
modifierData CatalogModifier | undefined Optional A modifier applicable to items at the time of sale.
timePeriodData CatalogTimePeriod | undefined Optional Represents a time period - either a single period or a repeating period.
productSetData CatalogProductSet | undefined Optional Represents a collection of catalog objects for the purpose of applying a
PricingRule. Including a catalog object will include all of its subtypes.
For example, including a category in a product set will include all of its
items and associated item variations in the product set. Including an item in
a product set will also include its item variations.
pricingRuleData CatalogPricingRule | undefined Optional Defines how discounts are automatically applied to a set of items that match the pricing rule
during the active time period.
imageData CatalogImage | undefined Optional An image file to use in Square catalogs. It can be associated with
CatalogItem, CatalogItemVariation, CatalogCategory, and CatalogModifierList objects.
Only the images on items and item variations are exposed in Dashboard.
Only the first image on an item is displayed in Square Point of Sale (SPOS).
Images on items and variations are displayed through Square Online Store.
Images on other object types are for use by 3rd party application developers.
measurementUnitData CatalogMeasurementUnit | undefined Optional Represents the unit used to measure a CatalogItemVariation and
specifies the precision for decimal quantities.
subscriptionPlanData CatalogSubscriptionPlan | undefined Optional Describes a subscription plan. For more information, see
Set Up and Manage a Subscription Plan.
itemOptionData CatalogItemOption | undefined Optional A group of variations for a CatalogItem.
itemOptionValueData CatalogItemOptionValue | undefined Optional An enumerated value that can link a
CatalogItemVariation to an item option as one of
its item option values.
customAttributeDefinitionData CatalogCustomAttributeDefinition | undefined Optional Contains information defining a custom attribute. Custom attributes are
intended to store additional information about a catalog object or to associate a
catalog object with an entity in another system. Do not use custom attributes
to store any sensitive information (personally identifiable information, card details, etc.).
Read more about custom attributes
quickAmountsSettingsData CatalogQuickAmountsSettings | undefined Optional A parent Catalog Object model represents a set of Quick Amounts and the settings control the amounts.

Example (as JSON)

{
  "type": "ITEM_VARIATION",
  "id": "id0",
  "version": null,
  "is_deleted": null,
  "custom_attribute_values": null,
  "catalog_v1_ids": null,
  "present_at_all_locations": null,
  "present_at_location_ids": null,
  "absent_at_location_ids": null,
  "item_data": null,
  "category_data": null,
  "item_variation_data": null,
  "tax_data": null,
  "discount_data": null,
  "modifier_list_data": null,
  "modifier_data": null,
  "time_period_data": null,
  "product_set_data": null,
  "pricing_rule_data": null,
  "image_data": null,
  "measurement_unit_data": null,
  "subscription_plan_data": null,
  "item_option_data": null,
  "item_option_value_data": null,
  "custom_attribute_definition_data": null,
  "quick_amounts_settings_data": null
}