How do I add new property in the response of http://localhost:8080/openmrs/ws/rest/v1/location

Hello There, I have added one column in location table with name image and also setup all the mapping for the same. But I want that image property to be respond in the end point http://localhost:8080/openmrs/ws/rest/v1/location

I am getting this property after hitting the end point http://localhost:8080/openmrs/ws/rest/v1/location/f5a926e8-ff75-4655-86d6-c4022033600e please help me to solve this what currently I am able to get

I want to add one more property in this response called logo. Thanks.

Did you abandon the idea of using location attributes?

1 Like

Hey @dkayiwa I think in location attribute there is no datatype like blob or longblob.Thats why I am stick on this.

Did you evaluate the option of it being a path to the location of the image? Or a base64 encoded string of the image?

I am actually want to display location name with associate logo image. I added column, image also fetched the through /location/UUID but I have no Idea is this api triggering while appears. I am only able to see location I’d UUID and name.

I understood concept of LA but when a user with specific location loged in is there any way to fetch location attributes.

I don’t know am I going in the appropriate direction. can please help to do it with both way because I know what you suggested is actual use case that I have.

Thank you

Here is an example of a call to fetch a location with attributes:

1 Like

@atiq how are you storing your image to the database.are you storing it as a blob or you are simply storing its location to the db?

1 Like

@herbert24 I am storing in longblob.

why not store it on the server and its path to the db

1 Like

Yah but after login how can I get that image path to display some where in home page is there any existing api call where I can include the location image path to use it. Beacause what I see in header.jsp in appui module only I am getting location name ,I’d and UUID , I have already added logo blob in the mapping and also getting it when I hit location/UUID but I have no ideas is this api end triggering when home appears because I need that path to display location logo or image.

It will be really helpful to give me a path that I can follow I will improve my approach as I understand the code. Thanks @herbert24 and @dkayiwa for your replies, You guys never get irritated due to questioning .hats off to you guys.Appreciates your dedication.:blush:

Hello Guys, I have done that what I am expecting thanks for your kind help.@herbert24 and @dkayiwa

you could go on to share your solution on this thread

1 Like

Yah. @herbert24 I just added one column in location table and did mapping for the same in openmrs core. Then in web-rest module I added the logo property in location resources file. Then I am able to get the logo data in /location/uuid end point. Then I did some ui changes with appui module in header.jsp page. Time being I called an api location/uuid in both cases when a normal user get logged in and admin user. It handles all the scenario like admin change the location from ui then logo for that location also gets appear. I have recorder the screen as gif for complete understanding but unable to upload it here. Thanks