Unable to download file using file download endpoint.

Hello Guys,

I have a portal interface which shows all the documents assigned to a contact in CRM.

I need to create functionality where upon click of a file name the file should get downloaded (like we have browser download).

To achieve this I'm calling sugarCRM file download API

$url = $instance_url . "/DocumentRevisions/{$RevisionId}/file/filename";

File Download:: args :: {"__sugar_url":"v11_1\/DocumentRevisions\/cf17a6b2-e91c-11ea-aa9e-fc3fdbd87f9d\/file\/filename","format":"sugar-html-json","platform":"base\/","module":"DocumentRevisions","record":"cf17a6b2-e91c-11ea-aa9e-fc3fdbd87f9d","field":"filename"}
File Download:: field :: "filename"
File Download:: Bean ID :: "cf17a6b2-e91c-11ea-aa9e-fc3fdbd87f9d"
File Download:: SugarBean ACLFieldAccess :: true
File Download:: def :: {"name":"filename","vname":"LBL_FILENAME","type":"file","dbType":"varchar","required":true,"len":"255","allowEapm":true,"linkModuleOverride":"Documents"}
File Download:: forceDownload :: true
File Download:: api ::
File Download:: download :: {}
File Download:: DownloadFile validateBeanAndField inside IF ::
File Download:: DownloadFile validateBeanAndField def :: {"name":"filename","vname":"LBL_FILENAME","type":"file","dbType":"varchar","required":true,"len":"255","allowEapm":true,"linkModuleOverride":"Documents"}
File Download:: DownloadFile validateBeanAndField info :: {"content-type":"application\/msword","content-length":137728,"name":"180414_Pegasus TDS policy.doc","uri":"","path":"upload:\/\/cf17a6b2-e91c-11ea-aa9e-fc3fdbd87f9d","doc_type":"Sugar"}
File Download:: DownloadFile validateBeanAndField sf :: {"error":null,"hasButton":false,"type":"File"}
File Download:: DownloadFile validateBeanAndField info :: {"content-type":"application\/msword","content-length":137728,"name":"180414_Pegasus TDS policy.doc","uri":"","path":"upload:\/\/cf17a6b2-e91c-11ea-aa9e-fc3fdbd87f9d","doc_type":"Sugar"}
File Download:: DownloadFile validateBeanAndField forceDownload :: true
File Download:: DownloadFile validateBeanAndField header ::
File Download:: DownloadFile validateBeanAndField readfile :: 137728
File Download:: getFile :: null

The API is returning me null as output. Above are the log statements I have added in all the files and functions which manipulate data and return file.

Please any suggestion will be highly appreciated.