Below is the complete example of how to get the file from SharePoint:
var hostweburl = decodeURIComponent(getParameterByName('SPHostUrl'));
var appweburl = decodeURIComponent(getParameterByName('SPAppWebUrl'));
var fileContentUrl = "_api/SP.AppContextSite(@target)/web/GetFileByServerRelativeUrl('/site/library/madcow.xlsx')/$value?@target='" + hostweburl + "'";
var executor = new SP.RequestExecutor(appweburl);
var info = {
url: fileContentUrl,
method: "GET",
binaryStringResponseBody: true,
success: function (data) {
//binary data available in data.body
var result = data.body;
},
error: function (err) {
alert(JSON.stringify(err));
}
};
executor.executeAsync(info);
Source: How to copy files between sites using JavaScript REST in Office365 / SharePoint 2013.
You can also check below documentation for Complete basic operations using SharePoint REST endpoints:
Complete basic operations using SharePoint REST endpoints.