How to iterate response from dynatrace managed user sessions api endpoint?

Only first 50 rows are returned. Is there a counter or page index which can be incremented to retrieve next batch of rows?

How your query looks like? According to documentation you should be able to get up to 5000 results:

https://www.dynatrace.com/support/help/monitor/use…

See limitation seciont. Didn’t you have any TOP function in query?

Regards,

Sebastian

SELECT TOP(distinct(userid),2000) from usersession where useraction.application = ‘<App_Name_String>’ group by userid order by user id

which encodes to

userSessionQueryLanguage/table?query=SELECT%20top(distinct(userid)%2C2000)FROM%20usersession%20WHERE%20useraction.application%20%3D%20’<App_Name_String>'%20group%20by%20userid%20order%20by%20userid&startTimestamp=1545202800000&endTimestamp=1545206400000

even if I use

SELECT userid from usersession where useraction.application = ‘App_Name_String’

OR

SELECT userid from usersession

it will still return 50 rows

No attribute in response available which could allow iterating the next batch.

You didn’t set timeframe so I assume that it can return you users from short one. maybe this is the problem.

I did set time frame in unix timestamp

I am sure its correct and I have verified its accurate

Tried using timeframe in script as well in the api explorer

Same issue persists

Try it like this:

SELECT userid from usersession LIMIT 1000

In this query dynatrace not allow higher limit than 1000.

Cool. This works. :slightly_smiling_face:

Thanks . Well it fetches more than 5000 at once.

I have the same problem, No matter what i set, the response is only 50 rows max in a managed solution.

We try with this kind of query:

SELECT usersession.ip, application, name, targetUrl,usersession.userId, startTime FROM useraction WHERE usersession.userType = "REAL_USER" GROUP BY usersession.ip, application, name, targetUrl,usersession.userId,startTime ORDER BY usersession.ip, startTime

To group all users by ip and application.by default it would be the last 2 hours. that’s aprox at least 10k of user actions (5k per hour) but ended only showing no more than 50 user ressults.

Thanks Dante. Will give it a try.

Hope you are able to retrieve more than 50 rows now using LIMIT