I am currently customizing the header and I want to display the current login location in the header.I thought I would find this information using the /session endpoint but this only has the logged in user details.
Kindly advise how I can get this information.
You can get this whole location information using location end point./ws/rest/v1/location
To get the current user session and location information, let's play with /ws/rest/v1/appui/session
This works. Thanks!
I followed you advice on using the appui/session endpoint and now a change of location from the homepage reflects on the OWA module I'm working on.
However, the question of setting the sessionLocation in reverse that is, from the OWA app we are building came about during the Addon manager demo and I thought of making a post to edit the /appui/session sessionLocation property, but it does not work.
I have also looked for documentation of this endpoint but can't seem to find it.
Hi @suthagar23, I am also having the same blocker, what API can i use to set a new location.Thanks cc @dkayiwa
I am using that one in SysAdmin OWA. Can you take a look at here for setOpenMRSLocation function,
This works for me.
Thanks a bunch!
Does this also work when I'm not running the appui module?
Help me understand: is everyone reimplementing their own UI widgets for thepage header with behavior for changing locations?
That would be bad.
-Darius (by phone)
Noted @darius, I believe your first point can be solved by ensuring the generator-openmrs-owa scaffolds the UI widgets for thepage header. I'll create a ticket for this and possibly look into it.For your second point, should we disable the login location changing feature on other screens going forward?
For the first point, we should avoid duplicating the code in every everyowa. In other words, we should define the widget in an npm project like"common-openmrs-react-widgets", and the scaffolding can just include this.
For the second point, ignore this for now, and forget I said anything. (Aslong as we can have a reusable widget and aren't duplicating the businesslogic in every OWA, it's fine.)
Hi @suthagar23 is there an endpoint I can use to get authenticated user that doesn't require me to have the appui module installed?
@ivange94 I worked on this before to get another endpoint. But most of the previous OWA used this endpoint and I couldn't find any other endpoint for this purpose.
@suthagar23 thanks. @dkayiwa any help here? We need to use this in radiology and declaring a dependency to appui which may also end up having other dependencies to use just one endpoint doesn't sound like the right way for us. Do you think this can be moved to the webservices.rest module?
@ivange94 what you are saying makes perfect sense!Do you wanna create the ticket? It would be awesome if you can also do the pull request.
Doesn't /ws/rest/v1/session deliver the autthenticated user information?
@willa thanks. I think this is what I was looking for.