Skip to main content
Solved

Update Product item via API


Forum|alt.badge.img+1

I am trying to update a product from the catalog with the api: https://developers.klaviyo.com/en/reference/update_catalog_item

When i was trying this i was getting erorr.:

This is the the body:

7175259619489 is the item ID

 

{

  "data": {

    "type": "catalog-item",

    "id": "$custom:::$default::7175259619489",

    "attributes": {

      "title": "Ocean Blue Shirt (Sample)",

      "price": 42,

      "description": "A description of the catalog item.",

      "url": "https://via.placeholder.com/150",

      "image_full_url": "https://via.placeholder.com/300",

      "image_thumbnail_url": "https://via.placeholder.com/150",

      "custom_metadata": {

        "newKey": "New Value"

      },

      "published": true

    },

    "relationships": {

      "categories": {

        "data": [

          {

            "type": "catalog-category",

            "id": "$custom:::$default:::SAMPLE-DATA-CATEGORY-APPAREL"

          }

        ]

      }

    }

  }

}



This is the error:

 

{

    "errors": [

        {

            "id": "b9e0d202-8058-40ec-9988-14d2c9a3c6f8",

            "status": 400,

            "code": "invalid",

            "title": "Invalid input.",

            "detail": "'$custom:::$default::7175259619489' does not match the primary key used at the endpoint. '$custom:::$default:::7175259619489' is the expected primary key.",

            "source": {

                "pointer": "/data/id"

            },

            "meta": {}

        }

    ]

}

Best answer by David To

Hello @anthony_monk,

Welcome to the Klaviyo Community!

Can you confirm if this item you’re trying to update is part of a custom catalog? In my experience, users often times make the mistake that using this catalog endpoint, they can update any product - which is not true. 

This endpoint will only allow you to update products as part of your custom catalog, not products as part of an ecommerce catalog such as Shopify, BigCommerce, WooCommerce, etc. 

If you are running both a custom catalog and ecommerce catalog, I would further suggest ensuring that both catalogs are not sharing the same product IDs as a means to prevent an identification issue. 

I hope this helps!

David

View original
Did this topic or the replies in the thread help you find an answer to your question?

3 replies

David To
Klaviyo Employee
Forum|alt.badge.img+60
  • Klaviyo Employee
  • 2456 replies
  • Answer
  • May 11, 2023

Hello @anthony_monk,

Welcome to the Klaviyo Community!

Can you confirm if this item you’re trying to update is part of a custom catalog? In my experience, users often times make the mistake that using this catalog endpoint, they can update any product - which is not true. 

This endpoint will only allow you to update products as part of your custom catalog, not products as part of an ecommerce catalog such as Shopify, BigCommerce, WooCommerce, etc. 

If you are running both a custom catalog and ecommerce catalog, I would further suggest ensuring that both catalogs are not sharing the same product IDs as a means to prevent an identification issue. 

I hope this helps!

David


Forum|alt.badge.img+1
  • Contributor III
  • 5 replies
  • September 12, 2024

Hi @David To ,

 

So in my understanding there is no way to extend the item object for a ecommerce catalog item?


  • Contributor I
  • 1 reply
  • December 11, 2024

Hello !

 

Can I add custom attribute under following parameter 

 

  "attributes": {

      "title": "Ocean Blue Shirt (Sample)",

      "price": 42,

      "description": "A description of the catalog item.",

      "url": "https://via.placeholder.com/150",

 

 

I want like 

 

  "attributes": {

      "title": "Ocean Blue Shirt (Sample)",

      "price": 42,

      "description": "A description of the catalog item.",

      "url": "https://via.placeholder.com/150",

   “custom_key”: “Custom_Value”

 

Thanks