REST Resource: projects.locations.catalogs.branches.products

Resource: Product

Product captures all metadata information of items to be recommended or searched.

JSON representation
{
  "name": string,
  "id": string,
  "type": enum (Type),
  "primaryProductId": string,
  "categories": [
    string
  ],
  "title": string,
  "description": string,
  "attributes": {
    string: {
      "text": [
        string
      ],
      "numbers": [
        number
      ]
    },
    ...
  },
  "tags": [
    string
  ],
  "priceInfo": {
    object (PriceInfo)
  },
  "availableTime": string,
  "availability": enum (Availability),
  "availableQuantity": integer,
  "uri": string,
  "images": [
    {
      object (Image)
    }
  ]
}
Fields
name

string

Immutable. Full resource name of the product, such as projects/*/locations/global/catalogs/default_catalog/branches/default_branch/products/productId.

The branch ID must be "default_branch".

id

string

Immutable. Product identifier, which is the final component of name. For example, this field is "id_1", if name is projects/*/locations/global/catalogs/default_catalog/branches/default_branch/products/id_1.

This field must be a UTF-8 encoded string with a length limit of 128 characters. Otherwise, an INVALID_ARGUMENT error is returned.

Google Merchant Center property id. Schema.org Property Product.sku.

type

enum (Type)

Immutable. The type of the product. This field is output-only.

primaryProductId

string

Variant group identifier. Must be an id, with the same parent branch with this product. Otherwise, an error is thrown.

For Type.PRIMARY Products, this field can only be empty or set to the same value as id.

For VARIANT Products, this field cannot be empty. A maximum of 2,000 products are allowed to share the same Type.PRIMARY Product. Otherwise, an INVALID_ARGUMENT error is returned.

Google Merchant Center Property item_group_id. Schema.org Property Product.inProductGroupWithID.

This field must be enabled before it can be used. Learn more.

categories[]

string

Product categories. This field is repeated for supporting one product belonging to several parallel categories. Strongly recommended using the full path for better search / recommendation quality.

To represent full path of category, use '>' sign to separate different hierarchies. If '>' is part of the category name, please replace it with other character(s).

For example, if a shoes product belongs to both ["Shoes & Accessories" -> "Shoes"] and ["Sports & Fitness" -> "Athletic Clothing" -> "Shoes"], it could be represented as:

 "categories": [
   "Shoes & Accessories > Shoes",
   "Sports & Fitness > Athletic Clothing > Shoes"
 ]

Must be set for Type.PRIMARY Product otherwise an INVALID_ARGUMENT error is returned.

At most 250 values are allowed per Product. Empty values are not allowed. Each value must be a UTF-8 encoded string with a length limit of 5,000 characters. Otherwise, an INVALID_ARGUMENT error is returned.

Google Merchant Center property google_product_category. Schema.org property Product.category.

title

string

Required. Product title.

This field must be a UTF-8 encoded string with a length limit of 128 characters. Otherwise, an INVALID_ARGUMENT error is returned.

Google Merchant Center property title. Schema.org property Product.name.

description

string

Product description.

This field must be a UTF-8 encoded string with a length limit of 5,000 characters. Otherwise, an INVALID_ARGUMENT error is returned.

Google Merchant Center property description. schema.org property Product.description.

attributes[]

map (key: string, value: object)

Highly encouraged. Extra product attributes to be included. For example, for products, this could include the store name, vendor, style, color, etc. These are very strong signals for recommendation model, thus we highly recommend providing the attributes here.

Features that can take on one of a limited number of possible values. Two types of features can be set are:

Textual features. some examples would be the brand/maker of a product, or country of a customer. Numerical features. Some examples would be the height/weight of a product, or age of a customer.

For example: { "vendor": {"text": ["vendor123", "vendor456"]}, "lengths_cm": {"numbers":[2.3, 15.4]}, "heights_cm": {"numbers":[8.1, 6.4]} }.

A maximum of 150 attributes are allowed. Otherwise, an INVALID_ARGUMENT error is returned.

The key must be a UTF-8 encoded string with a length limit of 5,000 characters. Otherwise, an INVALID_ARGUMENT error is returned.

attributes[].text[]

string

The textual values of this custom attribute. For example, ["yellow", "green"] when the key is "color".

At most 400 values are allowed. Empty values are not allowed. Each value must be a UTF-8 encoded string with a length limit of 256 characters. Otherwise, an INVALID_ARGUMENT error is returned.

Exactly one of text or numbers should be set. Otherwise, an INVALID_ARGUMENT error is returned.

attributes[].numbers[]

number

The numerical values of this custom attribute. For example, [2.3, 15.4] when the key is "lengths_cm".

At most 400 values are allowed.Otherwise, an INVALID_ARGUMENT error is returned.

Exactly one of text or numbers should be set. Otherwise, an INVALID_ARGUMENT error is returned.

tags[]

string

Custom tags associated with the product.

At most 250 values are allowed per Product. This value must be a UTF-8 encoded string with a length limit of 1,000 characters. Otherwise, an INVALID_ARGUMENT error is returned.

This tag can be used for filtering recommendation results by passing the tag as part of the PredictRequest.filter.

Google Merchant Center property custom_label_0–4.

priceInfo

object (PriceInfo)

Product price and cost information.

Google Merchant Center property price.

availableTime

string (Timestamp format)

The timestamp when this Product becomes available recommendation and search.

A timestamp in RFC3339 UTC "Zulu" format, with nanosecond resolution and up to nine fractional digits. Examples: "2014-10-02T15:01:23Z" and "2014-10-02T15:01:23.045123456Z".

availability

enum (Availability)

The online availability of the Product. Default to Availability.IN_STOCK.

Google Merchant Center Property availability. Schema.org Property Offer.availability.

availableQuantity

integer

The available quantity of the item.

uri

string

Canonical URL directly linking to the product detail page.

This field must be a UTF-8 encoded string with a length limit of 5,000 characters. Otherwise, an INVALID_ARGUMENT error is returned.

Google Merchant Center property link. Schema.org property Offer.url.

images[]

object (Image)

Product images for the product.

A maximum of 300 images are allowed.

Google Merchant Center property image_link. Schema.org property Product.image.

Type

The type of this product.

Enums
TYPE_UNSPECIFIED Default value. Default to Type.PRIMARY if unset.
PRIMARY

The primary type.

As the primary unit for predicting, indexing and search serving, a Type.PRIMARY Product is grouped with multiple Type.VARIANT Products.

VARIANT

The variant type.

Type.VARIANT Products usually share some common attributes on the same Type.PRIMARY Products, but they have variant attributes like different colors, sizes and prices, etc.

COLLECTION The collection type. Collection products are bundled Type.PRIMARY Products or Type.VARIANT Products that are sold together, such as a jewelry set with necklaces, earrings and rings, etc.

PriceInfo

The price information of a Product.

JSON representation
{
  "currencyCode": string,
  "price": number,
  "originalPrice": number,
  "cost": number
}
Fields
currencyCode

string

The 3-letter currency code defined in ISO 4217.

If this field is an unrecognizable currency code, an INVALID_ARGUMENT error is returned.

price

number

Price of the product.

Google Merchant Center property price. Schema.org property Offer.priceSpecification.

originalPrice

number

Price of the product without any discount. If zero, by default set to be the price.

cost

number

The costs associated with the sale of a particular product. Used for gross profit reporting.

Google Merchant Center property cost_of_goods_sold.

Availability

Product availability. If this field is unspecified, the product is assumed to be in stock.

Enums
AVAILABILITY_UNSPECIFIED Default product availability. Default to Availability.IN_STOCK if unset.
IN_STOCK Product in stock.
OUT_OF_STOCK Product out of stock.
PREORDER Product that is in pre-order state.
BACKORDER Product that is back-ordered (i.e. temporarily out of stock).

Image

Product thumbnail/detail image.

JSON representation
{
  "uri": string,
  "height": integer,
  "width": integer
}
Fields
uri

string

Required. URI of the image.

This field must be a valid UTF-8 encoded URI with a length limit of 5,000 characters. Otherwise, an INVALID_ARGUMENT error is returned.

Google Merchant Center property image_link. Schema.org property Product.image.

height

integer

Height of the image in number of pixels.

This field must be nonnegative. Otherwise, an INVALID_ARGUMENT error is returned.

width

integer

Width of the image in number of pixels.

This field must be nonnegative. Otherwise, an INVALID_ARGUMENT error is returned.

Methods

create

Creates a Product.

delete

Deletes a Product.

get

Gets a Product.

import

Bulk import of multiple Products.

patch

Updates a Product.