Solved

How should array parameter values be formatted for the Cohorts API?

  • 24 January 2023
  • 9 replies
  • 86 views

Userlevel 1
Badge

Hi!

I’ve been trying out the Behavioural Cohorts API but I’m having trouble using the propKeys parameter to limit the user properties returned when downloading a cohort.

I could be missing something obvious, but there are multiple standards out there for supplying arrays as querystring parameters and I’ve tried out a few:

  • ?props=1&propKeys=property_1&propKeys=property_2
  • ?props=1&propKeys[]=property_1&propKeys[]=property_2
  • ?props=1&propKeys=[property_1,property_2]

Can anyone clarify the expected format? So far I’ve always had all user properties present in the downloaded data.

An example on the documentation page or in the Postman collection would be great!

icon

Best answer by Denis Holmes 26 January 2023, 13:07

View original

9 replies

Userlevel 5
Badge +9

Thanks for reaching out @Adam Chester. We don’t have any examples related to what you’ve outlined here but the team is happy to add an exampled to our developer docs and postman. Here’s more info. 

 

Userlevel 1
Badge

Hi @Jeremie Gluckman - thanks for your reply!

Am I correct in understanding that an example will be added to the Postman collection? Is there any way I can get a prod when that’s been done?

Userlevel 6
Badge +8

Hi @Adam Chester , there should be Behavioral Cohorts API here in the collection. Are you still having issues with the API and getting properties? If so, please PM me your Org ID, Project ID, cohort link and what exactly you want to get out of it. Thank you!

Userlevel 5
Badge +9

Thank you @Denis Holmes! @Adam Chester Circling back here. I misspoke in my previous reply,  our support team can help you figure out the actual format to use for your request, and we'll use that info to add an example for future use.

Userlevel 1
Badge

there should be Behavioral Cohorts API here in the collection.

Thanks Denis, there is an example but as far as I can see there’s no example with filled values for the querystring parameters, which would show me how to send the array value for propKeys.

I’ve sent you the info you requested, in case that’s helpful.

Thanks,
Adam

Userlevel 2
Badge +1

Heyo, I’m watching this thread -- if y’all post the solution when you find it, I’ll add an example to Postman and the docs. Thanks!

Userlevel 1
Badge

@casey_amplitude @Jeremie Gluckman 

 

@Denis Holmes was able to give me an example that worked perfectly.

The required format is repeating the array parameter key-name with the various values in the querystring, so for example:

?props=1&propKeys=property_1&propKeys=property_2&propKeys=property_3

Thanks for your help all!

Userlevel 2
Badge +1

Thanks @Adam Chester I’ll get that added to the docs!

Userlevel 2
Badge +1

Update: I’ve added two new examples to the Postman collection, and added the same examples to the developer docs. Thanks so much for the feedback!

Reply