Solved

Updating a custom list property via API is not working as expected

  • 14 May 2021
  • 2 replies
  • 533 views

Badge +2

Hello,

I want to update the Shopify Tag propery 

which on edit mode looks like this:
 

Updating it via UI works, but when I do it via API the quotes are escaped
 



To reproduce it you can simply do a PUT cURL request like described in API docs
 


Please let me know if I’m doing something wrong, the docs are wrong or if you need any additional info.

Thanks

icon

Best answer by Scott 17 May 2021, 15:36

View original

2 replies

Userlevel 1
Badge +2

Hi @Petru 

 

In order to update or add an array/list property to a profile you need to pass the query parameter and value for each item in the list e.g.

?newKey=cat&newKey=dog

This will then be reflected on the profile as

 

Two things to note.

  1. Updating a custom property will overwrite the existing one. If you are adding an item to the list/array you’ll need to include all the existing values in your PUT request.
  2. If you only add a single value this will convert the value to a string and it will not longer be a list.

Additionally, it’s not recommended to manually update the Shopify Tags property on a profile as this property is automatically updated through the Shopify integration sync. This property does not sync back to Shopify, therefore the value can get out of sync if it’s updated manually in Klaviyo.

 

Best,

Scott

Badge +2

Thanks for this answer @Scott - helped me out today :0)

However, I have a load of profiles that include an ampersand in the value of a list-type property, like this:

"Preferences": [
   "Help & advice",
   "Special offers"
],

 

Of course, the ampersand breaks the query string in the request url.
Is there a way of including an ampersand in the value of the list property when updating via the api?

 

Thanks!
Martin

Reply