Reputation: 609
I'm building a client-side dashboard that makes use of the Jenkins REST API to fetch data about jobs. That's the easy part. I haven't yet figured out how to display, for example, the current user's name (though I did find the path to any particular user, but that's not dynamic: [jenkinsRoot]/users/[name]/api
).
Is there a hidden REST path that contains any information about the current user?
If not, is there an alternative? I've already checked the cookie, and it doesn't have the username.
Upvotes: 1
Views: 5085
Reputation: 1144
As of at least v1.565.3, you can get some good info at /me/api/json
.
Upvotes: 2
Reputation: 41408
The only place I can find to hit data about a user in Jenkins 1.5 is:
/user/[user_name]/api/[json|xml]
Currently, there doesn't seem to be a REST endpoint for 'who am i'. Also, none of the other resources look as if they expose the current user.
I guessing it's assumed if you're using the credentials with the [user_name] to authenticate you should just enter it in the request ULR for the user resource endpoint to get the user resource.
You could probably make a simple plugin to expose the currently authenticated user: https://wiki.jenkins-ci.org/display/JENKINS/Exposing+data+to+the+remote+API
Upvotes: 1