I can't update product

16 views
Skip to first unread message

George Arthur

unread,
Nov 5, 2021, 6:47:57 AM11/5/21
to Google Content API for Shopping
I'm trying to update a product using content api but I keep on getting this response;

The requested URL /content/v2.1/XXXXXXX/products/9343?alt=json&key=AIzaSSSDCQI313XXXXXXXXX was not found on this server. That’s all we know.

This is my update request;
https://content.googleapis.com/content/v2.1/XXXXXXX/products/9343?alt=json&key=AIzaSSSDCQI313XXXXXXXXX - PUT
Request Body: 
{
  availability: "in stock",
channel: "online",
condition: "new"
contentLanguage: "en",
id: 9343,
   ...
}

Using the function

export const AddEditProduct = (gapi, data, merchantId, type="ADD") => {
    // Use gapi.client.request(args) function
    const args = {
        'rootUrl': 'https://shoppingcontent.googleapis.com',
        'path': `/content/v2.1/${merchantId}/products${type === 'UPDATE' ? `/${data.id || data.offerId}` : ''}`,
        'method': type === "UPDATE" ? 'PUT' : 'POST',
        'body': JSON.stringify(data)
    };  

    // Execute the API request.  
    return new Promise((resolve, reject) => {
        return gapi.client.request(args)
        .then((response) => {
            resolve(response)
        })
        .catch((error) => {
            reject(error)
        })
    })    
};

Shopping API Forum Advisor

unread,
Nov 5, 2021, 11:00:22 AM11/5/21
to geo...@plendify.com, google-content-...@googlegroups.com
Hi,

Are you trying to use Products.update call? If so, it should be PATCH: https://developers.google.com/shopping-content/reference/rest/v2.1/products/update

Thanks,

Google Logo
Lakshmi Prathipati
Content API for Shopping Team
 

 

ref:_00D1U1174p._5004Q2R6Zwi:ref
Reply all
Reply to author
Forward
0 new messages