09 Feb 2023
07:34 AM
- last edited on
09 Feb 2023
08:21 AM
by
MaciejNeumann
Hello,
I'm testing the Dynatrace Environment API v1.0 -> RUM - User Sessions.
Here is my curl command:
curl --location --request GET 'https://{{xxx}}.dynatrace-managed.com/e/{{env}}/api/v1/userSessionQueryLanguage/table?query=select startTime from usersession where startTime > "01/01/2023 00:00:00"&startTimestamp=1672502400000 \
--header 'Authorization: Api-Token {{token}}'
The result is:
{
"extrapolationLevel": 4,
"columnNames": [
"startTime"
],
"values": []
}
But when checking my Query User sessions, I have one result for this query.
My access Token already have "ReadConfig", "DTAQLAccess", "metrics.read", "apiTokens.read", "apiTokens.write"
Can someone help with investigating why my request is not returning my results.
Regards,
Abner
I think you don't have proper URL encoding for the USQL query in your request. If your USQL query works in the Dynatrace UI, then you just need to encode it properly so it can be passed in the URL query parameter. You can use https://www.urlencoder.org/ for example to quicky encode a string.
It works when I set the parameter "startTimestamp=0"
But the goal is get the 30 days before so when I'm using the milliseconds it doesn't work.
With this test, I can confirm that the USQL is not issue here.
Regards,
Abner
Update:
When using startTimestamp, it works only when value is equal to or less than 35 days.
But when using more than 35 days, it returns nothing.
Today is February 9, 2023, value for January 3 fails, while January 5 works.
Can you try on your end ?
Regards,
Abner
Hey @abnerlusung, maybe this can shed some light: https://www.dynatrace.com/support/help/how-to-use-dynatrace/data-privacy-and-security/data-privacy/d...
For example, I have 1 session yesterday.
It should return one when using 36 days, for my case, it does not. Makes sense?