Skip to main content
Solved

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

  • January 24, 2023
  • 9 replies
  • 423 views

Forum|alt.badge.img

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!

Best answer by Denis Holmes

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!

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

Jeremie Gluckman
Team Member
Forum|alt.badge.img+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. 

 


Forum|alt.badge.img

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?


Denis Holmes
Team Member
Forum|alt.badge.img+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!


Jeremie Gluckman
Team Member
Forum|alt.badge.img+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.


Forum|alt.badge.img
Denis Holmes wrote:

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


casey_amplitude
Team Member
Forum|alt.badge.img+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!


Forum|alt.badge.img

@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!


casey_amplitude
Team Member
Forum|alt.badge.img+1

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


casey_amplitude
Team Member
Forum|alt.badge.img+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


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