You need to sign in to do that
Don't have an account?

How to get URL of uploaded file from Amazon S3 Cloud Service using Salesforce..Using Rest API.
HI ALl,
I have a requirement with Salesforce with Amazon server with S3 Integration. I need to upload the files and same time download the files or URL of file form Amazon to Salesforce.
I have uploaded the file using PUT method. Response i m receiving is like only [Status=OK and Statuscode=200] successful
but i m not getting any other things like uploadid or URL of the file.
i need URL of the File uploaded in Salesforce. Help me out from this
Thanks,
Reddy
I am not getting anything in the Response body. [Status=OK and Statuscode=200] File got uploaded.
Thanks,
Srini
NOTE: When adding code please use the "Add a code sample" button (icon <>) to increase readability and make it easier to reference.
it doesn't appear to generate a UUID for this url, so it should be the same place that you PUT it.
I'm not understanding what you are saying. How to generate UUID in above Context. Can you give Sample code for that.
Thanks in advance
Thanks
Srini
[1] http://salesforce.stackexchange.com/questions/4073/how-to-generate-a-guid-uuid
I am exactly working on the same requirement. I am able to upload the files in AWS S3 from salesforce. I need to get the uploaded file URL from Aws S3 and save in my contacts field. If you have done it please let me know. If I do it, I will update here.
Thanks in advance.
Thanks for your reply.
Actually I have a bucket in S3 which is saving my videos. as of now, per contact we have only one video. so its not a problem if the new video over writes the existing one.
I have created a formula field in contact object as below:
'https://s3-ap-southeast-2.amazonaws.com/sree.video.files/' & CASESAFEID(Id) &'.mp4'
sree.video.files is my bucket name which is storing videos.
& CASESAFEID(id) is returning contact Id and now I am able to get the AWS Url in to my Contact.Video_Url__c field.(formula field)
I am refering Video_Url field to my visual page so that my video can play in vf page. but video is not playing may be due to formula field.
When I copy paste the Url in different field which is Text, then the video is playing.
Please advice.
Thanks in advance.
It is working now. I am able to play the video in VF page.
Can you please share the code here . both uploading and Downloading (URL of the File uploaded) the uploaded file
Thanks
Srini
I would recommend that you simply store that URL in a variable and then you can store it on your record. Either that or generate your URL in such a way that it can be derived from the record itself and then generate a formula.
I have user formula field in contact object. I have given the below code:
'https://s3-ap-southeast-2.amazonaws.com/sree.video.files/' & CASESAFEID(Id) &'.mp4'
I have used Aws S3 tool kit code to upload files.
I have created few buckets for different files. when ever customer updates his photo or video, I only need his latest updated files.
so the files updated in force.com web pages, over writes the existing files.
so there will be only one file for profile video for that particular contact. so I am appending his contact Id to the Aws path. I am able to play videos in website because I have given the contact field in the backend. and the contact field contains the latest path from Aws.
whats ur mail Id Srini ?
and my URL looks like this:
'https://s3-ap-southeast-2.amazonaws.com/<bucketName>/'+contact.Id+'.mp4';
As I am in sydney, I use the URL as "s3-ap-southeast-2.amazonaws.com"
my mail id is
cnu.nandhikonda@gmail.com
But getting error SignatureDoesNotMatch and message The request signature we calculated does not match the signature you provided. Check your key and signing method.
Can anyone pleae let me know what wrong I am doing here?
public void getObject(){
String timestamp = Datetime.now().formatGmt('EEE, dd MMM yyyy HH:mm:ss Z');
String bucket = 'testbucket';
String key = 'Access Key';
String method = 'GET';
String secret = 'Secret key';
String stringToSign = 'GET\n\n\n'+timestamp+'\n/'+bucket+'/'+'testfolder/Passport.pdf';
String encodedStringToSign = EncodingUtil.urlEncode(stringToSign,'UTF-8');
Blob bsig = Crypto.generateMac('HMacSHA1',Blob.valueOf(encodedStringToSign),Blob.valueof(secret));
String Signature = EncodingUtil.base64Encode(bsig);
HttpRequest req = new HttpRequest();
req.setMethod(method);
req.setHeader('Host',bucket+'.s3.amazonaws.com');
req.setEndpoint('https://'+bucket+'.s3.amazonaws.com'+'/'+bucket+'/'+foldername+'/'+'Passport.pdf');
req.setHeader('Content-Encoding', 'UTF-8');
req.setHeader('Authorization','AWS '+key+':'+signature);
req.setHeader('Date',timestamp);
Http http = new Http();
HttpResponse res = http.send(req);
system.debug('+++++Body is'+res.getBody());
}
[1] http://blog.deadlypenguin.com/blog/2016/02/16/amazon-s3-attaching-a-file-in-salesforce/
I used the above code to upload files successfully. Below is the endpoint:
https://jstart-salesforce.s3.amazonaws.com/jstart-salesforce/0000001017/250x125-licenseplate_red.png
But, when I am trying to access the file by pasting the URL on browser I am getting error "<Code>AccessDenied</Code><Message>Access Denied</Message>". I put the URL on URL and Text type fields on Salesforce Asset object, but it does not display the image.
Thanks and Regards,
Subrat
please need help on this
Could you please share s3 code to mee... its very urgent to me
Thanks & Regards
Jasveer Singh
info.jasveer@gmail.com
Can anyone help me in providing a link to a document or a sample code which explains on how to read csv files stored on s3 bucket from salesforce?
Thanks!
Attach file related to any Salesforce object on Amazon.
5 GB 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.
I am also getting the issue same as @Subrat kumar Ray 23 when i hit the URL.
I am getting error "<Code>AccessDenied</Code><Message>Access Denied</Message>".
Thanks in Advance.
I came across the newly developed app in AppExchange named Drag, Drop & Upload Files to Amazon S3 for this am using the same and its very easy to understand and having advanced features like you can delete/view your files from salesforce, and also provide some additional customization.
Please have look: https://sforce.co/34y12sL