Using the Google Shopping APIs
November 8, 2011
Today I hope to introduce you to the Google Shopping APIs. A basic roadmap for the next 30 minutes of your life:
- What are the Shopping APIs?
- Google Product Search and Data
- When would you use a Shopping API?
What are the Shopping APIs?
Product data stored in Google Merchant Center can be available on all Google Shopping Sites
10,000 Foot View of Shopping APIs
- The Content API for Shopping puts the data in the Merchant Center
- The Search API for Shopping gets the data out of the Merchant Center
Content API based on HTTP, REST & GData
With the Content API for Shopping, you can programmatically
- Upload product data for Google Product Search
- Manage sub-accounts for marketplaces
- Manage data feeds
With the Search API for Shopping
- Search for keywords for results similar to Google Product Search
- Restrict searches by key attributes such as brand and price
- Build applications on top of product data
The Search API for Shopping can be used in three cases:
- The public use case (for tinkering)
- By Google Affiliate Network publishers
- By Commerce Search customers
Google Product Search and Data
What kind of value can we add to the shopper's experience?
Define price limits
Define her style
Imagine herself in the dress!
In order to ensure the data for product search users is of utmost quality, we try to use and combine as much data as possible. We also have a data freshness policy in place to maintain reliable results.
If the product is listed at $102 in results, the user expects to be able to buy that item for $102.
The Policy: "When a user comes to your website from Product Search, he or she expects to see the same price and availability as what is shown in Product Search results, or, what is provided in your data to us. For example, if the product is listed as being 'in stock' in results, the user expects to be able to buy that item -- it is disappointing when that item is not actually available for purchase. For these reasons, we check your website regularly to ensure information provided to us is the same as on your website - at all times. If your website and the data you provide to us do not match, your items may be suspended from Product Search results."
When would you use a Shopping API?
- In such a world where shoppers are so influenced by research, you can imagine many inventive ways to use shopping data
- Can you imagine? If not, demo! If you can, still demo!
Whoa, how does that work?
app = android.Android()
# Get search result
But where does the result come from?
- Search API for Shopping feature
- Classifies results into buckets predefined by user
facet = simplejson.loads(response)['facets']
for bucket in facet['buckets']:
OK, What about the Content API?
The Content API for Shopping is Real Time
- Very fast for inserting new products
- Immediate for updating existing products' price or quantity information
The Content API for Shopping is Automated
- Feedback responses are in the same format as the API
- Feedback responses are on a per-item level
- Error responses are immediate, allowing for immediate retries and automation
Performance data can also be retrieved through the Content API
How do you use the APIs?
Some implementation details
Request Body containing product information formatted as XML
POST to Products Endpoint
201 Response on success
- Unique URL for each product
- Specific product operations
Response body contains new product information
Test an implementation by making real API requests through our Interactive Demo
Open Source Client Libraries:
- Put multiple product operations into a single request
- Up to 1MB in each request
- Each request can be gzipped
- Response for each batched operation
- Errors reported individually
- Save on number of requests
- Dry run mode allows testing requests without actually inserting data
- All responses, errors and warnings are returned
- Enabled by adding the dry-run URL parameter
- Also available for all state changing operations:
How about implementing the Shopping API?
- Much smaller specification than the Content API
- Simple GET request, immediate response
- Consists of root URI
a required developer key and several other query parameters
- Response can be either XML or JSON (simply pass the query parameter alt=atom or alt=json)
- Search by item specific attributes
Using data to improve results:
- q - Full text search
- restrictBy - Restricting rules to restrict the result to matching products
- crowdBy - Crowding rules to diversify the products in the result
- rankBy - Ranking rule to order the products in the result
- facets - Histogram results returned for query
"name": "Apple Store",
- Active online communities on Google Groups
- Forums supported by myself and other engineers. Answers are searchable, adding to a knowledge base of developer questions
- Docs and Samples on our site
- Issue Tracker:code.google.com/p/shopping-api-issues/issues/list
Q & A