Get User of API request

I have a core API question. I did a REST API (/handlers/rest-apis…) and would like to find out which user did the request (basic auth). I created an onRestRequest interceptor and get back the data, but the user field is always empty. Any Chance to get user of the request?

Use case: For logging purposes we’d like to know which user did how many REST requests against our API.

UPDATE: postInvokeRestResource interceptor instead of onRestRequest is the key

The other option here is to use the REST framework’s authentication system:

https://docs.preside.org/devguides/restframework.html#authentication

Once you have an auth provider setup and configured for your API, you can use restRequest.getUser() to get the ID of the authenticated user from within your resource handler.