Solved

Getting events for a specific profile - New APIs

  • 3 January 2023
  • 5 replies
  • 443 views

Badge +1

Hi All,

 

With the new APIs I’m curious what’s the recommended approach to get all event for a specific profile. Previously it would be done through https://developers.klaviyo.com/en/v1-2/reference/profile-metrics-timeline but it's unclear how to do it with the new API.

 

Could someone provide insights into this?

 

icon

Best answer by alex.hong 4 January 2023, 23:44

View original

5 replies

Userlevel 7
Badge +58

Hi @hellonoam ,

Welcome to the Community.

Have you tried using the following line to fetch profile fields?

https://a.klaviyo.com/api/events/?fields[event]=event_properties,id,profile_id&fields[profile]=email,phone_number&include=profiles

Let me know how that goes. As for if you want to bulk update profiles, we're working on adding this to the new APIs.  Since the older APIs will still be active for at least another year, please feel free to continue using that service until we've had the chance to add the functionality to the new APIs.
  

Badge +1

Hi @alex.hong

 

That’s not exactly what I’m looking for. I want to get all the events for a specific profile, not all events and have them include profiles. 

For example, I want to get all the events that user XYZ did in the last 30 days. How do I do that with the new API?

Userlevel 7
Badge +58

Hi @hellonoam ,

Apologies.

Right now, the new API does not have a way to pull in all of a profile’s metrics the same way we were able to with the old API.  Our engineer teams are currently working on building out this feature but it is not available yet.  Here are some alternatives in the meantime:

 

Hope that helped,

Alex

Badge +5

@alex.hong Any updates on this since 3 months ago?  I’m in the same boat where I need to show events for the last X days on a separate screen through an integration.  I’m currently using the v1/v2 “timeline” endpoint and it works great, but of course it’s going to be deprecated soon.

I can get all events for a specific profile using getEvents and a filter, but it doesn’t include the metric name.  If I “include” the metric, it just gives me the metric ID, not the name.  The only way I can see to do it at the moment is to loop through all of the events and make a separate call for each one to get the metric name, but that feels really inefficient and potentially dangerous with rate limits, especially if there are 50-100 metrics to display.

Am I missing something?  Or do I truly need to just wait for this feature to roll out?  I’m just a bit worried that it will come late in the year and v1/v2 will be deprecated shortly after, giving me a tiny window to make the changes.

Userlevel 7
Badge +36

Hi @Digimatic!

 

I see that you posted this question in another thread that I just responded to, so for the sake of organization and visibility I will just link to that post here:

 

Thanks for using the Community!

- Brian

Reply