Reputation: 11
I need to get a list of users who logged in within the last 2 years. YouTrack Web interface shows me 141 users on /admin/hub/users?query=lastAccess(after:%202018-01-01)
But when I try to get the same list via API, I get an empty array. What am I doing wrong? Here's my API request:
curl -X GET "https://[my_youtrack_URL]/api/admin/users?query=lastAccess(after:%202018-01-01)&$skip=0&$top=200"
Upvotes: 1
Views: 823
Reputation: 11
I got the answer from the YouTrack developers, it's two-fold:
1) First, the endpoint for request concerning users is different - this is a "hub" feature, so the endpoint should be /hub/api/rest/users
(as also mentioned by @Jk1 above).
2) Second, the correct syntax for the query is lastAccess(after:+2018-01-01)
(+
instead of %20
).
Upvotes: 0
Reputation: 11463
What am I doing wrong?
You're missing an authentication token.
Try adding the following to your curl command -H "Authorization: Bearer mytoken123"
. The token itself can be created in your YouTrack user profile.
Upvotes: 1