Fetch File with Data

Hello,

I am saving a certain file with file reference.

Now I want to fetch the data with actual file and not the file reference. How can I achieve that, since for fetching the file api is different than the rest-service api

For file submission, jmix uses rest/files and for data fetching I am using rest/services. I don’t want to hit 2 different api for fetching the data and the api.

Is it possible with single api ?

Thanks in advance.

For a single API, create a Custom Controller.

Hi,

Using Custom Controller, means fetching file from fileRef, then converting it to some string format and sending it as response, right ?

Yes, but there are plenty of ways to return a file from a REST controller, see for example https://www.baeldung.com/spring-controller-return-image-file

1 Like