+ Start a Discussion
WilmerWilmer 

How to read Amazon S3 files from Salesforce by using REST API

Hi, I would like to get some information or sample code about how to read an external file (ie. pdf file) which is located at AWS S3. I´ve already know there is a toolkit to do that, but I also found out that Amazon has deprecated SOAP for their services and it would be sooner or later when they decide not to support anymore new SOAP request (now for example they do it only in https calls and said they won't updgrade SOAP methods, according to their documentation).

Any help on this with some sample code would be appreciated.
Gupta.VishalGupta.Vishal
Hi Wilmer , 

I have done Amazon S3 integration with force.com in my previous projects but with SOAP only , 

since now they are moving from SOAP to REST then it will be any normal REST api call over HTTP ,

I found this 
http://docs.aws.amazon.com/AmazonS3/latest/API/RESTServiceGET.html docs for their GET services , All you have to do is to get auth key and make request e.g.
 
String endpoint ='s3.amazonaws.com';

Http http=new Http();

HttpRequest request=new HttpRequest();
request.setMethod('Get');
request.setEndpoint(endpoint);
req.setHeader('Authorization', AuthKey); //Authkey will be key you get from amazon
 
HTTPResponse res = http.send(req);




Thanks , 
Vishal 
sakshi Gandhi 8sakshi Gandhi 8
Have you find any solution we are facing same issue
S3-LinkS3-Link
S3- Link is FREE App for Salesforce - Amazon Connector. Its also available on Appexchange. 
 

    Attach file related to any Salesforce object on Amazon.
    Ulimited free storage for one year.
    Multiple file uplaod.
    No file size limit for upload.
    File access control capabiliy.
    Track file downloads by users.
    File exlorer capability.

https://appexchange.salesforce.com/listingDetail?listingId=a0N3000000CW1OXEA1

Here is our email address. Let us know if you have any query.
support@neiloncloud.com

Thanks.
sravan velamasravan velama
Hi Gupta.Vishal

I am getting blank file while downloading it from aws.
The size of the file is same as in aws but the content is blank
The file which i am downloading is a pdf file.
can you help me out what would be the reason

Regards,
Sravan
 
Prachi Gadewar 12Prachi Gadewar 12
Hello @sravan velama,

Did you find solution on this? Can you please post your code of REST call.

KR
PRachi