In the above link it is given that we have to make a GET request to the downloadUrl (which we get in the response when we upload the file) in order to get the file contents.
The downloadUrl which I got after uploading file to google drive is : "downloadUrl": "https://doc-10-cc-docs.googleusercontent.com/docs/securesc/2butu3k0aok5svkleqovepe3uqqvauqr/9o0jdpikd3jl5krf0vgcacuhfl8gro0v/1408694400000/05688347114777583261/05688347114777583261/0B602YDdndVQ6LUxZRC0wX1ZtWWs?h=16653014193614665626&e=download&gd=true"
Now i am making GET request like this:
Http http = new Http(); HttpRequest req = new HttpRequest(); req.setMethod('GET'); req.setEndpoint(downloadURL); req.setHeader('content-type', 'text/plain'); req.setHeader('Authorization','Bearer '+accessToken); req.setTimeout(60*1000); HttpResponse resp = http.send(req);
My problem is that, each time i upload the file i will get different downloadUrl such that it is difficult to change the remote site settings every time.Any way to dynamically change the remote site setting? Please help me.