Solved

Update Product item via API

  • 10 May 2023
  • 1 reply
  • 112 views

Badge +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": {}

        }

    ]

}

icon

Best answer by David To 11 May 2023, 16:13

View original

1 reply

Userlevel 7
Badge +60

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

Reply