27 Jul 2018 01:11 AM - last edited on 23 Mar 2023 10:40 AM by MaciejNeumann
Hi,
I am using python to extract all events through:
https://{id}.live.dynatrace.com/api/v1/events/
(described here: https://www.dynatrace.com/support/help/dynatrace-a...
It states: "Use the nextEventId and nextEventStartTms information to query the next batch of events if the total number of events exceeds the maximum batch size of 150 events per request."
Does someone have an example of the follow-on GET requests. I have tried adding the two as parameters to the follow on request, but I am always getting back the first 150 event batch.
Here is the extract from the python code:
Parameters = {
'Api-Token': ApiToken
}
r = requests.get(Uri, params=Parameters)
d = r.json()
while d['nextEventStartTms'] > 0:
Parameters = {
'Api-Token': ApiToken,
'nextEventStartTms': d['nextEventStartTms'],
'nextEventId': d['nextEventId']
}
r = requests.get(Uri, params=Parameters)
d = r.json()
print(d['nextEventStartTms'], d['nextEventId'])
time.sleep(2)
Status Code = 200
Total Event Count: 1686
Time: 2018-06-27T09:53:37.733000 - 2018-07-27T09:53:37.733000
1532477700000 1386030597903004191
1532477700000 1386030597903004191
1532477700000 1386030597903004191
1532477700000 1386030597903004191
1532477700000 1386030597903004191
Solved! Go to Solution.
18 Mar 2019 01:57 PM
You have to use the next returned cursor value within the next request. Then you can iterate through the complete result set.