Solved

Why does User Activity API return empty list of events?

  • 20 August 2021
  • 3 replies
  • 272 views

Badge

Hi everyone!

I am trying to get list of events with event properties for a user. I see that events are shown in Events Stream on UI, however User Activity API returns OK response, but empty list of events.

I send cURL like this based on API documentation:

curl -u API_Key:Secret_Key 'https://amplitude.com/api/2/useractivity?user={AmplitudeID}'

Please advise what is wrong. Maybe it is a bug? Thanks!

icon

Best answer by eddie.gaona 21 August 2021, 00:07

View original

3 replies

Userlevel 5
Badge +9

Hello @zlotko 

Looks like you are using the User Activity endpoint, here.

When I tried using the following call through Terminal(Mac) the response worked as expected as the documentation details:

curl -u API_Key:Secret_Key 'https://amplitude.com/api/2/useractivity?user=221369364143'

 

Could you try the above call and simply replacing the Amplitude ID with that of the user you want to pull and the API_Key and Secret_Key of the Amplitude project that user belongs to, please? Let me know how that goes!

Badge

Hello @eddie.gaona,

Does your response contain any events? I sent the same curl command through Terminal(Mac), response is ok, userData is present, but there are no events, although events are present for this user on Web UI in Events stream.

{"events": [], "userData": {"revenue": 0, "purchases": 0, "usageTime": 0, "firstSeen": -9223372036854775808, "lastSeen": -9223372036854775808, "lastLocationLat": 1.7976931348623157e+308, "lastLocationLong": 1.7976931348623157e+308, "deviceIds": [], "properties": {}, "user_id": "0036C00000f5zPEQAY", "last_device_id": "bbc2389a-f860-5b7f-9bbe-e9cd3836f8b9", "canonical_amplitude_id": 290411990424, "merged_amplitude_ids": [], "merge_times": {}, "aliasing_user_ids": [], "aliased_user_id": null, "aliasing_profiles": {}, "num_events": 0, "num_sessions": 0, "usage_time": 0, "device_ids": [], "last_location": {"lng": 1.7976931348623157e+308, "lat": 1.7976931348623157e+308}}, "metadata": {"missingData": false}}

Userlevel 5
Badge +9

Hello @zlotko,

 

Yes the response contains the events as expected. Are you using the correct API Key and Secret Key for the project the user you are looking for?

I am able to replicate the behavior you are describing when I use the wrong project API Key and Secret Key.

Reply