Google Merchant Center Product Feed Api
The products
resource allows for a great deal of flexibility and control over more than 60 product attributes.There are a number of fields that are mandatory, and must be included in order to be approved for display on Google Shopping. There are a number of optional fields that can become mandatory based on varying conditions such as location, type of product, product variants, and product bundles. For more details on the 60+ optional parameters that can be configured for products, refer to the Product Data Specifications.
The products
resource lets you insert
, get
, update
and delete
one product at a time, and list
all products in the merchant center database.
The productstatuses
resource can be used to check on the approval or disapproval status of a specific product for a destination. Refer to the product status guide for more details on which products may have data quality issues and what those issues may be.
In our API examples, we use three products: two Google t-shirts and a Google cap. We use a minimal set of product data shown in the table below to make products
resource calls to insert, get, update, list, and delete individual products and batches of products.
We recommend that Shipping and Tax information be configured at the account level rather than at a product level.
For multi-seller sub-accounts of Marketplaces, all products must include the external_seller_id
field. See Product IDs for more details.
id | online:en:US:1111111111 | online:en:US:2222222222 | online:en:US:3333333333 |
---|---|---|---|
offerId | 1111111111 | 2222222222 | 3333333333 |
title | The Black Google Tee | Google Tee Green | Google Twill Cap |
description | The Black Google Tee | 100% cotton Google t-shirt | Classic Google cap |
item group ID | google_tee | google_tee | |
link | http://my.site.com/blacktee | http://my.site.com/greentee | http://my.site.com/blackhat |
condition | New | New | New |
price | 21.99 USD | 21.99 USD | 10.99 USD |
availability | In Stock | In Stock | In Stock |
imageLink | https://shop.example.com/ | https://shop.example.com/ | https://shop.example.com/ |
gtin | 9504000059422 | 9504000059446 | 9504000059452 |
mpn | 00638NIC | 00638ANG | 00638ABC |
brand | |||
Google product category | Apparel & Accessories > Clothing | Apparel & Accessories > Clothing | Apparel & Accessories > Clothing Accessories > Hats |
color | black | green | black |
size | L | M | M |
age_group | adult | adult | adult |
gender | male | male | unisex |
included_destination | Shopping Actions, Shopping Ads | Shopping Actions, Shopping Ads | Shopping Actions |
Products.Insert
To insert a single product, use the following request URL, specifying your merchant ID and a sample JSON body. An insert creates the new product. If values exist for the attributes channel
, contentLanguage
, offerId
, and feedLabel
for a given product, this method updates that entry and replaces all data from previous API calls for the given product.
The example shown inserts a new "Black Google Tee" to the products available.
POST https://shoppingcontent.googleapis.com/content/v2.1/{merchantId}/products
Sample request body call for products.insert
:
{ "kind": "content#product", "offerId": "1111111111", "title": "Google Tee Black", "description": "The Black Google Tee is available in unisex sizing.", "link": "http://my.site.com/blacktee/", "imageLink": "https://shop.example.com/.../images/GGOEGXXX1100.jpg", "contentLanguage": "en", "targetCountry": "US", "feedLabel": "US", "channel": "online", "ageGroup": "adult", "availability": "in stock", "availabilityDate": "2019-01-25T13:00:00-08:00", "brand": "Google", "color": "black", "condition": "new", "gender": "male", "googleProductCategory": "1604", "gtin": "608802531656", "itemGroupId": "google_tee", "mpn": "608802531656", "price": { "value": "21.99", "currency": "USD" }, "sizes": [ "Large" ] }
A product can also have custom attributes set within the JSON body. For example, we can set a purchase_quantity_limit
for a single product in order to limit the number of items a customer can order:
"customAttributes": [ { "name": "purchase_quantity_limit", "value": "4" } ]
Note that the purchase_quantity_limit
custom attribute sets a purchase limit per customer order to the product definition and is also supported by feeds. The attribute is currently in beta until fully supported by the API. Any additional custom attribute can be added by a merchant but does not result in any specific processing by the APIs.
A successful call returns an HTTP 200
code and a response body containing the inserted product resource with only id
, offerId
, contentLanguage
, feedLabel
, and channel
populated:
{ "kind": "content#product", "id": "online:en:US:1111111111", "offerId": "1111111111", "contentLanguage": "en", "targetCountry": "US", "feedLabel": "US", "channel": "online" }
Products.Get
To get information on a specific product in the Merchant Center database, use products.get
. It can take a few minutes for a newly inserted product to be available through this call.
Use the following HTTP request URL and parameters, your merchant ID, and the product ID (REST ID format) for the product that you want to get:
GET https://shoppingcontent.googleapis.com/content/v2.1/{merchantId}/products/{productId}
A successful call returns an HTTP 200
and the "product resource" in the response body. Here is sample product data retrieved from a product with ID online:en:US:1111111111
:
{ "kind": "content#product", "id": "online:en:US:1111111111", "offerId": "1111111111", "source": "api", "title": "Google Tee Black", "description": "The Black Google Tee is available in unisex sizing.", "link": "http://my.site.com/blacktee/", "imageLink": "https://shop.example.com/.../images/GGOEGXXX1100.jpg", "contentLanguage": "en", "targetCountry": "US", "feedLabel": "US", "channel": "online", "ageGroup": "adult", "availability": "in stock", "availabilityDate": "2019-01-25T13:00:00-08:00", "brand": "Google", "color": "black", "condition": "new", "gender": "male", "googleProductCategory": "1604", "gtin": "608802531656", "itemGroupId": "google_tee", "mpn": "608802531656", "price": { "value": "21.99", "currency": "USD" }, "sizes": [ "Large" ] }
Products.Update
To update a single product, use the following request URL with the PATCH method, specifying your merchant ID, product ID, and a JSON body containing the data you would like to update for the product. Unlike products.insert
, that requires all applicable fields to be provided, products.update
only requires you to specify the fields you would like to change.
To add or modify an attribute, specify the field with the new value in the JSON body. The example shown will update the title
and description
of an existing "Black Google Tee" with the product data provided in the request body, leaving all other fields untouched.
PATCH https://shoppingcontent.googleapis.com/content/v2.1/{merchantId}/products/{productId}
Sample request body call for products.update
:
{ "title": "Google Tee Black Limited Edition", "description": "The Limited Edition Tee is available in unisex sizing and features a retail fit." }
Only top-level fields can be updated via a products.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 salePrice
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://shoppingcontent.googleapis.com/content/v2.1/{merchantId}/products/{productId}
{ "salePrice": { "value": "17.99", "currency": "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 wish to modify. An updateMask
is useful when you want to assert that only the named fields will be updated. Not specifying an updateMask
is the equivalent of marking all fields in the request to be updated as shown in the example above.
The example shown will update only the description
and availability
of an existing "Black Google Tee" with the respective product data provided in the request body, leaving all other fields including the title
untouched.
PATCH https://shoppingcontent.googleapis.com/content/v2.1/{merchantId}/products/{productId}?updateMask=description,availability
Sample request body call for products.update
:
{ "title": "Google Tee Black", "description": "This Limited Edition is out of print.", "availability": "out of stock" }
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 salePrice
.
PATCH https://shoppingcontent.googleapis.com/content/v2.1/{merchantId}/products/{productId}?updateMask=salePrice
The sample request body should not include the salePrice
field in order to delete it. You may also provide no body or an empty body. Other fields will remain untouched provided they do not appear in the updateMask
.
To use updateMask
within a products.custombatch
request, the updateMask
should be specified in the body of the request.
The example shown will update the price
and availability
of an existing "Black Google Tee" using products.custombatch
with the product data provided in the batch entry, leaving all other fields including title
and description
untouched.
POST https://shoppingcontent.googleapis.com/content/v2.1/products/batch
{ "entries": [{ "batchId": 1, "merchantId": "MERCHANT_ID", "productId": "online:en:US:1111111111", "method": "update", "product": { "title": "Google Tee Black", "description": "The Black Google Tee is available in unisex sizing.", "availability": "in stock", "price": { "value": "19.99", "currency": "USD" } }, "updateMask": "availability,price" }] }
Products.Delete
To delete a single product, use products.delete
with the sample HTTP request URL, your merchant ID, and the product ID (in REST ID format such as online:en:US:1111111111
) for the product that you want to delete:
DELETE https://shoppingcontent.googleapis.com/content/v2.1/{merchantId}/products/{productId}
A successful response returns an HTTP Status 204
with no response body.
Products.List
products.list
lists all products that a merchant has in the merchant center database. Use the following request URL:
GET https://shoppingcontent.googleapis.com/content/v2.1/{merchantId}/products
A successful call returns an HTTP 200
and JSON data for products in the "resources" key.
The following three example products are returned:
{ "kind": "content#productsListResponse", "resources": [ { "kind": "content#product", "id": "online:en:US:1111111111", "offerId": "1111111111", "source": "api", "title": "Google Tee Black", "description": "The Black Google Tee is available in unisex sizing.", "link": "http://my.site.com/blacktee/", "imageLink": "https://shop.example.com/.../images/GGOEGXXX1100.jpg", "contentLanguage": "en", "targetCountry": "US", "feedLabel": "US", "channel": "online", "ageGroup": "adult", "availability": "in stock", "availabilityDate": "2019-01-25T13:00:00-08:00", "brand": "Google", "color": "black", "condition": "new", "gender": "male", "googleProductCategory": "1604", "gtin": "608802531656", "itemGroupId": "google_tee", "mpn": "608802531656", "price": { "value": "21.99", "currency": "USD" }, "sizes": [ "Large" ] }, { "kind": "content#product", "id": "online:en:US:2222222222", "offerId": "2222222222", "source": "api", "title": "Google Tee Green", "description": "100% cotton jersey fabric sets this Google t-shirt above the crowd. Features the google logo across the chest. Unisex sizing.", "link": "http://my.site.com/greentee/", "imageLink": "https://shop.example.com/.../images/GGOEGXXX0906.jpg", "contentLanguage": "en", "targetCountry": "US", "feedLabel": "US", "channel": "online", "ageGroup": "adult", "availability": "in stock", "availabilityDate": "2019-01-25T13:00:00-08:00", "brand": "Google", "color": "green", "condition": "new", "gender": "male", "googleProductCategory": "1604", "gtin": "608802531649", "itemGroupId": "google_tee", "mpn": "608802531649", "price": { "value": "21.99", "currency": "USD" }, "sizes": [ "Medium" ] }, { "kind": "content#product", "id": "online:en:US:3333333333", "offerId": "3333333333", "source": "api", "title": "Google Twill Cap", "description": "Classic urban styling distinguishes this Google cap. Retains its shape, even when not being worn.", "link": "http://my.site.com/blackhat/", "imageLink": "https://shop.example.com/.../images/GGOEGHPB071610.jpg", "contentLanguage": "en", "targetCountry": "US", "feedLabel": "US", "channel": "online", "ageGroup": "adult", "availability": "in stock", "availabilityDate": "2019-01-07T13:00:00-08:00", "brand": "Google", "color": "black", "condition": "new", "gender": "male", "googleProductCategory": "173", "gtin": "689355417246", "mpn": "689355417246", "price": { "value": "10.99", "currency": "USD" }, "sizes": [ "Medium" ] } ] }
Source: https://developers.google.com/shopping-content/guides/products/products-api
Belum ada Komentar untuk "Google Merchant Center Product Feed Api"
Posting Komentar