We use cookies on this site to remember: your settings, your history, whether you are logged in and to give you a better experience.
More info about cookies
Accept Cookies
Opt Out
You have an excellent choice of browser. Why not add our quick launch app so you can easily manage your shop in the future.Get our free app from the Google Chrome Store.
Login       Register

Extending the Google Shopping Content Model.

Extending the Google Shopping Content Model.

Warning, this article may include technical content, jargon, waffle and fluff.

This article is intended to help other developers that are working with the Google Shopping (or Google Merchant) API.

Once again, if you're a shop owner using us we have already done all this for you, we have only put this article up to try and help others and share our knowledge.

This article will explain how to extend the model to read "warnings". These are returned by Google and generally contain useful suggestions on how to improve a product description to ensure it is found by buyers searching.

To ensure products on GroovyCart get both a high ranking and appear on Google Shopping, we have a direct feed to Google. This product feed program runs at regularly times during the day and uploads new and changed products to Google using the Google Shopping Content API.

The program is written in Java and is based on the Google sample program (http://code.google.com/.../developers_guide_java.html). The Java program uses a "model" to map API data items to Java variables, thus simplifying the Java application This model is supplied by Google. However, the model is missing some useful items which have been added recently.


This is an example of a warning:

<sc:warnings> <sc:warning> <sc:code>validation/missing_recommended</sc:code> <sc:domain>ProductSearch</sc:domain> <sc:location>brand</sc:location> <sc:message>We recommend including this attribute.</sc:message> </sc:warning> </sc:warnings>

To get Google to return warnings you need to include "warnings" at the end of the URL, e.g. /items/products/schema/batch?warnings

Ok, now let's change the model com.google.api.client.sample.structuredcontent.model

1) As the warnings element is part of the AppControl, we need to edit public class AppControl to include warnings.

@Key("sc:warnings") public Warning warnings;

The @Key is clever, it maps the API XML item "warnings" to the Java data structure "warnings".

2) Next we need to define the data structure warnings in a new file "warning.java".

package com.google.api.client.sample.structuredcontent.model; import com.google.api.client.util.Key; public class Warning{ @Key("sc:warning") public List<WarningDetail> warningdetail; }

3) Finally, to complete the model, create new file "warningdetail.java":

package com.google.api.client.sample.structuredcontent.model; import com.google.api.client.util.Key; public class WarningDetail { @Key("sc:code") public String code; @Key("sc:domain") public String domain; @Key("sc:location") public String location; @Key("sc:message") public String message; /** * Returns a formatted string for displaying the information of the * warning. */ @Override public String toString() { return "Warning: Domain: " + domain + " Code: " + code + " Location: " + location + " Message: " + message; } }

Now let's use the structure in our Java application:

/* Do we have any warnings? */ if (p.appControl.warnings != null) { /* We have warnings. */ haveWarnings = true; /* Google returns a list of warnings - concaternate into a single string. */ if (p.appControl.warnings.warningdetail != null) { for (WarningDetail w : p.appControl.warnings.warningdetail) { /* This will go in the log (full message with all returned fields). */ warningTextLog = warningTextLog + "["+w.code+" "+w.domain+" "+w.location+" "+w.message+"] "; /* This will be displayed to the shop-owner (short friendly message). */ warningText = warningText + w.location+"="+w.message+" "; } } } if (haveWarnings) { /* We have warnings. */ logit(EM,"WARNING, batchID="+p.batchID+" : "+warningTextLog); }

We hope that can help someone!

View/Leave Comments

Getting Products On Google Merchant.

Sorry if you have already received an email regarding Google's rules on unique product identifiers (UPI) but this information is very important if you want to sell your products.

Many of our shops are now adhering to Google's criteria or have successfully been granted exemption status and I am very happy to say that, for them, sales have increased.

Other shops that are not aware of Googles new criteria (as from September 2011) or have not realised the importance of filling in the optional information for Google merchant, have not had the sales increase expected at this time of year.

So now I am going to explain so please forgive me if I repeat myself, I know we have sent out several emails on this subject but I need to explain how important this is and exactly what you need to do. Please read even if your products are being displayed on Google merchant, as Google are being very strict and in some cases threatening to ban shops that do not follow their 'guidelines'


  • 1. Provide at least one image (If you have had problems loading images, try reducing the size, med or high definition is fine, avoid max) Details below need to be added to the 'optional information for Google' either on the 'add new product' pages or the 'edit' pages or by using the 'mass product editor'.
  • 2. One or, in some cases, two of the following unique product identifiers must be filled in: MPN (Manufacturers Part Number), ISBN/Gtin, Brand, Manufacturer. Please do not make these up as Google are not easily fooled. If you are selling handmade or vintage items that do not have unique product identifiers then we can apply to Google for an exemption from having to fill in these fields. If you would like us to apply for you then please make sure that the fields mentioned above are left blank (only for the items that don't have UPI, please make sure you fill in those that do. It is very important that you fill in the 'product type' eg Dress, Bunting, Necklace, etc. also fill in as much relevant information such as size, colour, year, material, some or none of these may be applicable, but the more info you give the better.

Please make sure that you have done the above before applying, otherwise Google will refuse the exemption and this will delay the application.

If you have any questions please contact me, I am always happy to help.

Info from Google regarding Unique Product Identifier requirements:

Kind regards,

Jill & The Groovy Team

View/Leave Comments

Be groovy and share us around:
You might be interested in:
You can also find us on: