How to send multiple loyalty_program values using the Content API?

44 views
Skip to first unread message

Lance Robinson

unread,
Apr 30, 2024, 2:32:28 PMApr 30
to Google Content API for Shopping
I'm trying to send a value for the loyalty_program field via the Content API.

The main documentation (https://support.google.com/merchants/answer/12922446) specifically indicates that loyalty_program can have mutiple values, and I've verified this by uploading a TSV file and seeing both loyalty programs listed under my products, eg:

my_loyalty_program:silver:10 USD::10,my_loyalty_program:gold:9 USD::20

But my problem is that the Content API documentation (https://developers.google.com/shopping-content/reference/rest/v2.1/products#loyaltyprogram) shows that the field is NOT an array. How are we supposed to send multiple values using the Content API?

When I send loyalty_program, however, I get back the following error from Google:

I thought perhaps it was just an error in the Content API documentation, so I tried building my json payload with loyalty_program as an array, but when I do I get an error that makes me think it is NOT an array: "Invalid JSON payload received. Unknown name \\\"loyalty_program\\\" at 'body.entries[0].product': Proto field is not repeating, cannot start list.

Lance Robinson

unread,
Apr 30, 2024, 2:45:25 PMApr 30
to Google Content API for Shopping
To clarify that last part, if I send loyalty_program as a single object, no problem.

So this works (but only transfers a single program):
"loyalty_program":{"programLabel":"My Loyalty Program 2","tierLabel":"My Silver Tier 2","price":{"value":"99","currency":"USD"}

But this results in the "Proto field is not repeating, cannot start list." error:
"loyalty_program":[{"programLabel":"My Loyalty Program 2","tierLabel":"My Silver Tier 2","price":{"value":"99","currency":"USD"},"loyaltyPoints":"5"},{"programLabel":" My Loyalty Program 2","tierLabel":"My Gold Tier 2","price":{"value":"89","currency":"USD"}

How to send multiple loyalty_program values using the Content API?

Shopping API Forum Advisor

unread,
Apr 30, 2024, 5:32:30 PMApr 30
to google-content-...@googlegroups.com
Hi,

Thank you for contacting the Content API support team.

I understand that you would like to add multiple loyalty_program values using the Content API. To assist you better, please provide the following information for further investigation:
  • Merchant Center ID.
  • Provide a sample product ID.
  • The method you are using to add the loyalty program values (such as products.insert or custombatch method)?
  • Complete JSON request and response logs.
This message is in relation to case "ref:!00D1U01174p.!5004Q02tIqCD:ref" (ADR-00233238)

Thanks,
 
Google Logo Content API for Shopping Team


Lance Robinson

unread,
May 1, 2024, 9:21:15 AMMay 1
to Google Content API for Shopping
Thanks for the response.  See below for both working and non-working content API calls:

This one works fine, loyalty_program is sent as an object, not an array:

{"entries":[
{"batchId":0,"merchantId":9954782,"method":"insert","productId":"online:en:US:SKU1023","product":{"kind":"content#product","id":"online:en:US:SKU1023","offerId":"SKU1023","title":"Title1023","description":"Product Description 1023","link":"http://sap001.channeladvisor.com/american-standard-000117-0020a-cover-screw/p2?CAWELAID=120580500000638125","imageLink":"http://sap001.channeladvisor.com/imagebase/resized/x500/Moenimages/113173.jpg","lifestyleImageLinks":["http://lifestyle2"],"contentLanguage":"en","feedLabel":"US","channel":"online","adult":false,"autoPricingMinPrice":{"value":"11.00","currency":"USD"},"availability":"preorder","brand":"Brand1023","condition":"new","free_shipping_threshold":[{"country":"US","priceThreshold":{"value":"101.00","currency":"USD"}},{"country":" CA","priceThreshold":{"value":"99.99","currency":"USD"}}],"gtin":"UPC1023","mpn":"mpn1023","price":{"value":"2.00","currency":"USD"},"loyalty_program":{"programLabel":"My Loyalty Program 2","tierLabel":"My Silver Tier 2","price":{"value":"99","currency":"USD"},"loyaltyPoints":"5"},"productTypes":["Power Tools"]}}
]}

This one fails, loyalty_program is sent as an array, which according to the content API documentation shouldn't work anyway, but my question remains, how can I send multiple loyalty_programs?  Sending multiples works fine in a TSV file, but we need this functionality in the content API.

{"entries":[
{"batchId":0,"merchantId":9954782,"method":"insert","productId":"online:en:US:SKU1002","product":{"kind":"content#product","id":"online:en:US:SKU1002","offerId":"SKU1002","title":"Title1002","description":"Product Description 1002","link":"http://sap001.channeladvisor.com/american-standard-000117-0020a-cover-screw/p2?CAWELAID=120580500000639090","imageLink":"http://sap001.channeladvisor.com/imagebase/resized/x500/Moenimages/113173.jpg","lifestyleImageLinks":["http://lifestyle2"],"contentLanguage":"en","feedLabel":"US","channel":"online","adult":false,"autoPricingMinPrice":{"value":"11.00","currency":"USD"},"availability":"preorder","brand":"Brand1002","condition":"new","free_shipping_threshold":[{"country":"US","priceThreshold":{"value":"101.00","currency":"USD"}},{"country":" CA","priceThreshold":{"value":"99.99","currency":"USD"}}],"gtin":"UPC1002","mpn":"mpn1002","price":{"value":"2.00","currency":"USD"},"loyalty_program":[{"programLabel":"My Loyalty Program 2","tierLabel":"My Silver Tier 2","price":{"value":"99","currency":"USD"},"loyaltyPoints":"5"},{"programLabel":" My Loyalty Program 2","tierLabel":"My Gold Tier 2","price":{"value":"89","currency":"USD"},"loyaltyPoints":"10"}],"productTypes":["Power Tools"]}}
]}

response:
{
"entries": null,
"kind": null,
"error": {
"code": "400",
"message": "Invalid JSON payload received. Unknown name \"loyalty_program\" at 'body.entries[0].product': Proto field is not repeating, cannot start list.",
"errors": [
{
"domain": null,
"reason": "invalid",
"message": "Invalid JSON payload received. Unknown name \"loyalty_program\" at 'body.entries[0].product': Proto field is not repeating, cannot start list.",
"location": null
}
]
}
}




Shopping API Forum Advisor

unread,
May 2, 2024, 2:53:57 AMMay 2
to google-content-...@googlegroups.com
Hello,

Thank you for getting back to us.

I would like to inform you that it is not possible to add the loyalty_program, where you can only submit a single loyalty_program object using the Content API. From the help article, we can confirm that single loyalty_program is acceptable. The earlier shared format is for the supplemental feed while updating the loyalty_program. Can you please share any sample products item ID where you added multiple loyalty_program using the TSV file so that we can investigate further.

Lance Robinson

unread,
May 2, 2024, 10:16:36 AMMay 2
to Google Content API for Shopping
See product id 36 in that same merchant center.  Can you confirm then, that this is a bug, or at least an oversight in the Content API support for loyalty_program, and that there's currently no way to send multiple loyalty program tiers via the content API?  If so, would this be considered a priority to resolve?

Capture.JPG

Shopping API Forum Advisor

unread,
May 3, 2024, 2:26:36 AMMay 3
to google-content-...@googlegroups.com
Hello,

Thank you for getting back to us.

I will check with our team regarding this issue and will reach out to you once we have an update on it.

Lance Robinson

unread,
May 3, 2024, 7:07:45 AMMay 3
to Google Content API for Shopping
Someone else was able to help me find a workaround of using custom attribute group values.  But it does appear the content API needs an update to fix this oversight. I am unblocked for now.  Thanks.

Shopping API Forum Advisor

unread,
May 6, 2024, 1:15:11 PMMay 6
to google-content-...@googlegroups.com
Hi,

I would like to inform you that you can upload multiple loyalty_program values using the File feed in your account. I have raised a request to add this feature for adding multiple loyalty_programs through the Content API. I cannot provide a scheduled timeline of availability for this feature. You may refer to our release notes and blog post for future updates.
Reply all
Reply to author
Forward
0 new messages