Solved

Is there an API endpoint for replacing a list of catalog Category relationships on an item?

  • 14 March 2023
  • 3 replies
  • 46 views

Badge +2

Is there an API endpoint for replacing a list of catalog Category relationships on an item?

 

From my reading of the API docs its looks like you have to build your own system for checking if your item is still in a catalog Category then delete it if its not. E.g. API call to get relationships, then API call to check if the relationships are still valid, then API call to delete the non relevent categories, then API call to update with Current relationships.

 

It would be much simpler if you could just add a paramater to https://developers.klaviyo.com/en/reference/update_catalog_item and https://developers.klaviyo.com/en/reference/spawn_update_items_job that allows you to specify to“Replace” current catalog category relationships with the relationships in this API call.

 

Am I reading the API docs correctly or is there a hidden way to do this?

 

 

 

icon

Best answer by Brian Turcotte 21 March 2023, 15:27

View original

3 replies

Userlevel 7
Badge +36

Hi @more2science!

 

Just heard back from Engineering on this, and here’s what I’ve gathered:

  • Yes, any relationships included in an update_catalog_item call will replace all relationships for that item.
  • If you’d like to incrementally add or delete specific categories from an item relationships, you should utilize the relationship endpoints.
     

I will also make a suggestion to our Documentation team to include more specifics and examples in the docs so that this is more clear, but I hope this helps to clarify!

 

Best,

Brian

Userlevel 7
Badge +36

Hi @more2science!

 

I don’t believe that this is part of the current API functionality, but I will certainly check with Engineering to confirm and then update the thread.

 

Best,

Brian

Badge +2

I’ve done further testing and it looks like maybe the https://developers.klaviyo.com/en/reference/update_catalog_item API call is doing a replace when you have a relationships array in the API call.

Can anyone confirm this? it isn’t directly documented in the API docs.

Peter

Reply