Query User Action Table via API Using DQL for Detailed Insights

Hello all, I am trying to query useraction table

SELECTTop (usersession.userId,1000)FROM useractionWHERE application = myapp’AND usersession.userId IS NOT NULLAND usersession.userId IN (‘User EID : 781949’,‘User EID : 199730932’,)GROUP BY usersession.userIdLIMIT 5000I have thousands of coma seperated values in IN (‘User EID : 781949’,‘User EID : 199730932’,)

How I will run this query through api and get output as json reponse ?

I checked this documentation
https://docs.dynatrace.com/docs/discover-dynatrace/references/dynatrace-api/environment-api/rum/user…

I think v1 is now deprecated. Also please help on how to convert spaces in query to special symbols as seen in docs

Hi,
If you want to run this query via API and get the JSON response, just call the User Session Query Language API (v1) like this:

https://dynatrace.com/api/v1/userSessionQueryLanguage/table?query=SELECT%20usersession.userId%20FROM%20useraction%20WHERE%20application%20%3D%20%22myapp%22%20AND%20usersession.userId%20IS%20NOT%20NULL%20AND%20usersession.userId%20IN%20(%22User%20EID%20%3A%20781949%22%2C%22User%20EID%20%3A%20199730932%22)%20GROUP%20BY%20usersession.userId%20LIMIT%205000&addDeepLinkFields=false&explain=false

How to add %xx to space in the query. I have many queries and IN list contains 1000s of values to check.

You don’t need to manually replace spaces with %xx.
If you already have a working USQL query, the easiest way is to use the Dynatrace API Explorer (Swagger UI) — it automatically encodes your query and returns the JSON result.