Solved

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

  • 23 June 2023
  • 2 replies
  • 264 views

Badge

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!

icon

Best answer by Saish Redkar 23 June 2023, 04:24

View original

2 replies

Userlevel 7
Badge +10

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.

 

 

Badge

Got it, thanks @Saish Redkar!

Reply