Reference documentation and code samples for the Google Shopping Merchant Products V1 Client class ProductInput.
This resource represents input data you submit for a product, not the processed product that you see in Merchant Center, in Shopping ads, or across Google surfaces. Product inputs, rules and supplemental data source data are combined to create the processed Product . For more information, see Manage products .
Required product input attributes to pass data validation checks are primarily defined in the Products Data Specification . The following attributes are required: feedLabel , contentLanguage and offerId . After inserting, updating, or deleting a product input, it may take several minutes before the processed product can be retrieved. All fields in the product input and its sub-messages match the English name of their corresponding attribute in the Products Data Specification with some exceptions . The following reference documentation lists the field names in the camelCasecasing style while the Products Data Specification lists the names in the snake_casecasing style.
Generated from protobuf message google.shopping.merchant.products.v1.ProductInput
Namespace
Google \ Shopping \ Merchant \ Products \ V1Methods
__construct
Constructor.
data
array
Optional. Data for populating the Message object.
↳ name
string
Identifier. The name of the product. Format: accounts/{account}/productInputs/{productinput}
The {productinput} segment is a unique identifier for the product. This identifier must be unique within a merchant account and generally follows the structure: content_language~feed_label~offer_id
. Example: en~US~sku123
For legacy local products, the structure is: local~content_language~feed_label~offer_id
. Example: local~en~US~sku123
The format of the {productinput} segment in the URL is automatically detected by the server, supporting two options: 1. Encoded Format: The {productinput}
segment is an unpadded base64url encoded string (RFC 4648 Section 5). The decoded string must result in the content_language~feed_label~offer_id
structure. This encoding MUST be used if any part of the product identifier (like offer_id
) contains characters such as /
, %
, or ~
. * * Example: To represent the product ID en~US~sku/123
, the {productinput}
segment must be the base64url encoding of this string, which is ZW5-VVMtc2t1LzEyMw
. The full resource name for the product would be accounts/123/productinputs/ZW5-VVMtc2t1LzEyMw
. 2. Plain Format: The {productinput}
segment is the tilde-separated string content_language~feed_label~offer_id
. This format is suitable only when content_language
, feed_label
, and offer_id
do not contain URL-problematic characters like /
, %
, or ~
. We recommend using the Encoded Formatfor all product IDs to ensure correct parsing, especially those containing special characters. The presence of tilde ( ~
) characters in the {productinput}
segment is used to differentiate between the two formats. Note: For calls to the v1beta version, the plain format is channel~content_language~feed_label~offer_id
, for example: accounts/123/productinputs/online~en~US~sku123
.
↳ product
string
Output only. The name of the processed product. Format: accounts/{account}/products/{product}
↳ legacy_local
bool
Immutable. Determines whether the product is onlytargeting local destinations and whether the product name should be distinguished with a local~
prefix. For example, accounts/123/productInputs/local~en~US~sku123
. If a product that is not legacy_local
is already targeting local destinations, creating a legacy_local
product with an otherwise matching name will fail.
↳ offer_id
string
Required. Immutable. Your unique identifier for the product. This is the same for the product input and processed product. Leading and trailing whitespaces are stripped and multiple whitespaces are replaced by a single whitespace upon submission. See the products data specification for details.
↳ content_language
↳ feed_label
string
Required. Immutable. The feed label that lets you categorize and identify your products. The maximum allowed characters are 20, and the supported characters are A-Z
, 0-9
, hyphen, and underscore. The feed label must not include any spaces. For more information, see Using feed labels
.
↳ version_number
int|string
Optional. Immutable. Represents the existing version (freshness) of the product, which can be used to preserve the right order when multiple updates are done at the same time. If set, the insertion is prevented when version number is lower than the current version number of the existing product. Re-insertion (for example, product refresh after 30 days) can be performed with the current version_number
. Only supported for insertions into primary data sources. Do not set this field for updates. Do not set this field for insertions into supplemental data sources. If the operation is prevented, the aborted exception will be thrown.
↳ product_attributes
↳ custom_attributes
array< Google\Shopping\Type\CustomAttribute
>
Optional. A list of custom (merchant-provided) attributes. It can also be used for submitting any attribute of the data specification in its generic form (for example, { "name": "size type", "value": "regular" }
). This is useful for submitting attributes not explicitly exposed by the API. Maximum allowed number of characters for each custom attribute is 10240 (represents sum of characters for name and value). Maximum 2500 custom attributes can be set per product, with total size of 102.4kB. Underscores in custom attribute names are replaced by spaces upon insertion.
getName
Identifier. The name of the product.
Format: accounts/{account}/productInputs/{productinput}
The {productinput} segment is a unique identifier for the product.
This identifier must be unique within a merchant account and generally
follows the structure: content_language~feed_label~offer_id
. Example: en~US~sku123
For legacy local products, the structure is: local~content_language~feed_label~offer_id
. Example: local~en~US~sku123
The format of the {productinput} segment in the URL is automatically
detected by the server, supporting two options:
- Encoded Format: The
{productinput}segment is an unpadded base64url encoded string (RFC 4648 Section 5). The decoded string must result in thecontent_language~feed_label~offer_idstructure. This encoding MUST be used if any part of the product identifier (likeoffer_id) contains characters such as/,%, or~.- Example: To represent the product ID
en~US~sku/123, the{productinput}segment must be the base64url encoding of this string, which isZW5-VVMtc2t1LzEyMw. The full resource name for the product would beaccounts/123/productinputs/ZW5-VVMtc2t1LzEyMw.
- Example: To represent the product ID
- Plain Format: The
{productinput}segment is the tilde-separated stringcontent_language~feed_label~offer_id. This format is suitable only whencontent_language,feed_label, andoffer_iddo not contain URL-problematic characters like/,%, or~. We recommend using the Encoded Formatfor all product IDs to ensure correct parsing, especially those containing special characters. The presence of tilde (~) characters in the{productinput}segment is used to differentiate between the two formats. Note: For calls to the v1beta version, the plain format ischannel~content_language~feed_label~offer_id, for example:accounts/123/productinputs/online~en~US~sku123.
string
setName
Identifier. The name of the product.
Format: accounts/{account}/productInputs/{productinput}
The {productinput} segment is a unique identifier for the product.
This identifier must be unique within a merchant account and generally
follows the structure: content_language~feed_label~offer_id
. Example: en~US~sku123
For legacy local products, the structure is: local~content_language~feed_label~offer_id
. Example: local~en~US~sku123
The format of the {productinput} segment in the URL is automatically
detected by the server, supporting two options:
- Encoded Format: The
{productinput}segment is an unpadded base64url encoded string (RFC 4648 Section 5). The decoded string must result in thecontent_language~feed_label~offer_idstructure. This encoding MUST be used if any part of the product identifier (likeoffer_id) contains characters such as/,%, or~.- Example: To represent the product ID
en~US~sku/123, the{productinput}segment must be the base64url encoding of this string, which isZW5-VVMtc2t1LzEyMw. The full resource name for the product would beaccounts/123/productinputs/ZW5-VVMtc2t1LzEyMw.
- Example: To represent the product ID
- Plain Format: The
{productinput}segment is the tilde-separated stringcontent_language~feed_label~offer_id. This format is suitable only whencontent_language,feed_label, andoffer_iddo not contain URL-problematic characters like/,%, or~. We recommend using the Encoded Formatfor all product IDs to ensure correct parsing, especially those containing special characters. The presence of tilde (~) characters in the{productinput}segment is used to differentiate between the two formats. Note: For calls to the v1beta version, the plain format ischannel~content_language~feed_label~offer_id, for example:accounts/123/productinputs/online~en~US~sku123.
var
string
$this
getProduct
Output only. The name of the processed product.
Format: accounts/{account}/products/{product}
string
setProduct
Output only. The name of the processed product.
Format: accounts/{account}/products/{product}
var
string
$this
getLegacyLocal
Immutable. Determines whether the product is onlytargeting
local destinations and whether the product name should be distinguished
with a local~
prefix. For example, accounts/123/productInputs/local~en~US~sku123
. If a product that is not legacy_local
is already targeting local destinations,
creating a legacy_local
product with an otherwise matching name will
fail.
bool
setLegacyLocal
Immutable. Determines whether the product is onlytargeting
local destinations and whether the product name should be distinguished
with a local~
prefix. For example, accounts/123/productInputs/local~en~US~sku123
. If a product that is not legacy_local
is already targeting local destinations,
creating a legacy_local
product with an otherwise matching name will
fail.
var
bool
$this
getOfferId
Required. Immutable. Your unique identifier for the product. This is the same for the product input and processed product. Leading and trailing whitespaces are stripped and multiple whitespaces are replaced by a single whitespace upon submission. See the products data specification for details.
string
setOfferId
Required. Immutable. Your unique identifier for the product. This is the same for the product input and processed product. Leading and trailing whitespaces are stripped and multiple whitespaces are replaced by a single whitespace upon submission. See the products data specification for details.
var
string
$this
getContentLanguage
Required. Immutable. The two-letter ISO 639-1 language code for the product.
string
setContentLanguage
Required. Immutable. The two-letter ISO 639-1 language code for the product.
var
string
$this
getFeedLabel
Required. Immutable. The feed label that lets you categorize and identify
your products. The maximum allowed characters are 20, and the supported
characters are A-Z
, 0-9
, hyphen, and underscore. The feed label must
not include any spaces. For more information, see Using feed
labels
.
string
setFeedLabel
Required. Immutable. The feed label that lets you categorize and identify
your products. The maximum allowed characters are 20, and the supported
characters are A-Z
, 0-9
, hyphen, and underscore. The feed label must
not include any spaces. For more information, see Using feed
labels
.
var
string
$this
getVersionNumber
Optional. Immutable. Represents the existing version (freshness) of the product, which can be used to preserve the right order when multiple updates are done at the same time.
If set, the insertion is prevented when version number is lower than
the current version number of the existing product. Re-insertion (for
example, product refresh after 30 days) can be performed with the current version_number
.
Only supported for insertions into primary data sources.
Do not set this field for updates.
Do not set this field for insertions into supplemental data sources.
If the operation is prevented, the aborted exception will be
thrown.
int|string
hasVersionNumber
clearVersionNumber
setVersionNumber
Optional. Immutable. Represents the existing version (freshness) of the product, which can be used to preserve the right order when multiple updates are done at the same time.
If set, the insertion is prevented when version number is lower than
the current version number of the existing product. Re-insertion (for
example, product refresh after 30 days) can be performed with the current version_number
.
Only supported for insertions into primary data sources.
Do not set this field for updates.
Do not set this field for insertions into supplemental data sources.
If the operation is prevented, the aborted exception will be
thrown.
var
int|string
$this
getProductAttributes
Optional. A list of strongly-typed product attributes.
hasProductAttributes
clearProductAttributes
setProductAttributes
Optional. A list of strongly-typed product attributes.
$this
getCustomAttributes
Optional. A list of custom (merchant-provided) attributes. It can also be
used for submitting any attribute of the data specification in its generic
form (for example, { "name": "size type", "value": "regular" }
).
This is useful for submitting attributes not explicitly exposed by the API. Maximum allowed number of characters for each custom attribute is 10240 (represents sum of characters for name and value). Maximum 2500 custom attributes can be set per product, with total size of 102.4kB. Underscores in custom attribute names are replaced by spaces upon insertion.
setCustomAttributes
Optional. A list of custom (merchant-provided) attributes. It can also be
used for submitting any attribute of the data specification in its generic
form (for example, { "name": "size type", "value": "regular" }
).
This is useful for submitting attributes not explicitly exposed by the API. Maximum allowed number of characters for each custom attribute is 10240 (represents sum of characters for name and value). Maximum 2500 custom attributes can be set per product, with total size of 102.4kB. Underscores in custom attribute names are replaced by spaces upon insertion.
$this

