Hello everyone, Please, I need to get the currently logged in user that can be rendered on the standardEmrPage when that user is logged in. Does anyone know if there’s a REST API I can call to achieve this or is there any other means? Thanks.
Making a rest call to /ws/rest/v1/session
should do it, if there’s an authenticated user, there will be a user field in the returned json.
I thought the standardEmrPage already displays the authenticated user, why would you include them again?
If you’re trying to replicate standardEmrPage from the appui module, you might want this:
However it would be nice to find a way to do this without requiring the appui module itself (since that also depends on the uiframework module, and if you’re writing an OWA it shouldn’t require uiframework).
-Darius
Thank you very much for your response, I’ll try it asap.
Thanks a lot, @wyclif, I just tried the /sessions
endpoint and it worked for me. I’m working on the new cohortbuilder owa so I needed it for the standardEmrPage Header. Thanks again
@fortune, btw in case it is helpful, I played around trying to reproduce the standandEmrPage using react + web services as a learning exercise a while back. You can see what I did here: https://github.com/mseaton/openmrs-owa-reporting
Mike
Thanks, @mseaton, I’ll check that out ASAP and if I have any further questions, I’ll reach out to you.
Can we get all the currently logged in Users using any API?
You call Context.getAuthenticatedUser()