Fetch file from server using FileRef using CURL

Hi,

In the documentation of rest api it is shown how to send file to server. But how do we fetch the file from the server using the file reference path.

Found the solution for curl command as well as java code.