I am having difficulties setting up an endpoint with the services module to download a file. Ultimately I want the user to hit the services end point with something like
/api/download/file/fid and it will download the file to the users machine. The reason I want to do it through services and not just get users to hit
/sites/default/files/file.filetype is because I need to be able to restrict access to the download link with HTTP basic auth. I have tried searching but cannot find how to achieve this? any help is much appreciated.
EDIT: My xml response when I imported arpitr's endpoint configuration and called it.
<result> <fid>6</fid> <uid>1</uid> <filename>Transition1.jpeg</filename> <uri>public://Transition1.jpeg</uri> <filemime>image/jpeg</filemime> <filesize>435007</filesize> <status>1</status> <timestamp>1475199010</timestamp> <type>image</type> <uuid>4c703ad2-290c-4573-9a29-a7e86e1a874e</uuid> <field_file_image_alt_text/> <field_file_image_title_text/> <rdf_mapping/> <metadata> <height>2304</height> <width>3072</width> </metadata> <alt/> <title/> <height>2304</height> <width>3072</width> </result>
I am missing
<file> which is the content of the file base 64 encoded, any idea why this could be?