Use UpdateCssProductInput
method update an existing single CSS product by specifying product
cssProductInput.name
and a JSON body containing the data you would like to
update for the product.
Note: This method only updates the attributes provided in the update
request. The response contains the same attributes as the request and does
not reflect the full CssProductInput
state after the update is applied.
You shouldn't rely on the response to determine the final state of the
CssProductInput
.
PATCH https://css.googleapis.com/v1/accounts/{ACCOUNT_ID}/cssProductInputs/{CSS_PRODUCT_ID}
To add or modify an attribute in a product, specify the field with the new
value in the JSON body. The example shown will update the title
and headline offer link
of an existing product name 123/cssProductInputs/de~DE~B019G4
with the
attribute value provided in the request body, leaving all other fields
untouched.
PATCH https://css.googleapis.com/v1/accounts/{ACCOUNT_ID}/cssProductInputs/{CSS_PRODUCT_ID}
{
"attributes": {
"title": "new item title",
"headlineOfferLink": "headline-offer.com"
}
}
Only top-level fields can be updated with cssProductInputs.update
request.
If you want to update nested fields you must provide the entire top-level
object.
The example shown will update the top-level headlineOfferPrice
object,
including the nested fields of an existing product, with the product data
provided in the request body, leaving all other fields untouched.
PATCH https://css.googleapis.com/v1/accounts/{ACCOUNT_ID}/cssProductInputs/{CSS_PRODUCT_ID}
{
"attributes": {
"headlineOfferPrice": {
"amountMicros": "17.99",
"currencyCode": "USD"
}
}
}
To select certain fields to update without making changes to the others included
in the body of the request, you can specify an updateMask
. This query string
parameter should be a comma-separated list of fields you need to modify.
An updateMask
is useful when you want to assert that only the named fields
will be updated.
Not specifying an updateMask
is equivalent to marking all fields in the
request to be updated, as shown in the example. However, if an updateMask
is
not provided explicitly, it is not possible to delete existing attributes.
The example shown will update only the title
of the existing item with the respective product data provided in
the request body, leaving all other fields including the headline offer link
untouched.
PATCH https://css.googleapis.com/v1/accounts/{ACCOUNT_ID}/cssProductInputs/{CSS_PRODUCT_ID}?updateMask=title
{
"attributes": {
"title":"item-title",
"headlineOfferLink":"headline-offer-newer.com"
}
}
If a field is provided in the updateMask list but not in the body of the request, that field will be deleted from the Product resource, if it exists.
The example shown will use updateMask to remove the value for the field title
.
PATCH https://css.googleapis.com/v1/accounts/{ACCOUNT_ID}/cssProductInputs/{CSS_PRODUCT_ID}?updateMask=title
ACCOUNT_ID:
Unique identifier for the account, for example, 123
.
CSS_PRODUCT_ID:
CSS product ID, for example, de~DE~B019G4
.
To delete the title
field, leave it out of the request body. You can also
send the request with no body or an empty body. Fields not in the updateMask
will stay unchanged.