Skip to main content
Solved

Does updating a user property array via the HTTP API add to the array or reset it?


Forum|alt.badge.img

Hey team,

When using the HTTP API to publish an event with user properties included, will the existing user property array for the user get added to or updated entirely?

For example, if user Alice had a user property called `cohorts`, and I published a `join_cohort` event with `{ cohorts: [new_cohort_name] }` in user properties, will that outright set her `cohorts` value to just the new cohort or will it instead append the new cohort name to the existing list of cohorts? Thanks!

Best answer by Saish Redkar

Hi @Akash Gupta 

AFAIK, it will outright set the cohort value to the new cohort name.

Looking at the docs, it looks like HTTP API doesn’t support the append operation in case of user properties. But it does for group properties.

If you want the ability to append values to the property array, then you can use the Identify API to make the change instead of using HTTP API for that purpose.

Hope this helps.

 

 

View original
Did this topic help you find an answer to your question?

2 replies

Saish Redkar
Expert
Forum|alt.badge.img+10
  • Expert
  • 1380 replies
  • Answer
  • June 23, 2023

Hi @Akash Gupta 

AFAIK, it will outright set the cohort value to the new cohort name.

Looking at the docs, it looks like HTTP API doesn’t support the append operation in case of user properties. But it does for group properties.

If you want the ability to append values to the property array, then you can use the Identify API to make the change instead of using HTTP API for that purpose.

Hope this helps.

 

 


Forum|alt.badge.img
  • Author
  • Novice
  • 3 replies
  • June 23, 2023

Got it, thanks @Saish Redkar!


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings