Google Drive API returns 500 Internal Server Error when exporting large documents - ruby

I was trying to export(programmatically download from google drive) a slides document that is larger than 10MB in PDF format and encountered Error - #<Google::Apis::ServerError: Server error>.
I am using Google API ruby client and there is no specification on why this can happen. Documents that are <10MB when downloaded as PDF manually works fine when exported programmatically.
The method I use to export files is
#service.export_file(id, 'application/pdf', download_dest: StringIO.new).string,
#service is a Google::Apis::DriveV3::DriveService object.

Related

Unable to play Scorm 1.2 compliant content on Oracle Learning Management System (ebs 12.2)

Message shown while playing SCORM content:
Error : Unable to acquire LMS API.
I try to access the same SCORM package on other LMS i.e. Moodle and it works fine. We can also observe that the same content is opened on our LMS after working hour.
On modern browsers it shows the same message, but it works after refreshing the page.
The actual reason behind this problem is a configuration error that locates the address actual SCORM java applet location.

google drive api returns 403 forbidden when downloading file content

I am trying to download content of a previous revision of a file using the google drive api for Ruby Google::Apis::DriveV3::DriveService#get_revision:
Tempfile.create('file_revision-', encoding: 'ASCII-8BIT') do |temp_file|
drive_api_service.get_revision(file_id, revision_id, download_dest: temp_file)
# work with the content
end
I keep getting Google::Apis::ClientError with status code 403, reason phrase "Forbidden". The scope https://www.googleapis.com/auth/drive is enabled and the error occurs only when I am trying to download the content of the revision. If I run the code without the parameter download_dest, the request succeeds without any problems. I am also able to fetch any meta data or revision, export files, upload files etc., the problem only occurs when I try to fetch the content, either by get_file or get_revision.
Has anyone encountered this issue?
Is there an additional permissions that specifically needs to be added to allow content downloading?
I have also looked at other questions on stack overflow and I have checked all possible configuration for google drive api I could find and everything seems to be enabled.
Right now, Google drive api does not support content downloading for native google drive files (google docs, sheets etc.), so you cant download content (current or of an old revision), you can only export it to a different mime type.

Google Drive Rest API V3 Downloading large files with alt=media option (>25MB)

I am trying to figure out how I can download a large file directly in the browser via the Google Drive API V3.
I'm using option 1 which is : Download a file — files.get with alt=media file resource
When I send my request ( https://www.googleapis.com/drive/v3/files/[fileId]?alt=media), I got the content of the file as a response of it.
Currently I'm creating a blob file with the response of my query, then reading the blob file to start the download on the browser.
The problem with that is, reading the blob file consumes a lot of memory and if the file's size is more than 10MB, then browser crashes.
So my question is : how can I start the download on browsers via the Google APIs like mention on the screenshot bellow? See expected result
Try downloading the file in chunks using the range http header. See https://developers.google.com/drive/v3/web/manage-downloads "Partial download"

How to separate the files from Google Drive in the Response only using Rest API

Hi I'M new to windows phone Application development i'm working on how to get access the files from google drive using rest api i got the response in the response i got all the information like .pdf,.docs,mp3,mp4 ,folders etc...and the response is coming slow from the web for that is there any solution that.I should get response only that contains images and folders so that app will fast and accuracy... Thanks in Advance.
https://www.googleapis.com/drive/v2/files?q=mimeType contains 'image/jpeg'
The above link is for getting only images in this way according to mime type we can get the files rather than getting all files at a time

Uploading file using Web API and Azure server

I'm currently trying to upload image using ASP web API and save it in my Azure server using this tutorial
Then I took the request stream using Request.Content.ReadAsStreamAsync().Result and send it to Azure using blob.UploadFromStream(stream);
The file got uploaded and when I fetch the URL it returns something like
http://testing.cloudapp.net:10000/devstoreaccount1/saveFiles/File_2_2.zip
I tried the link but it just returns a blank page.
Any idea why I can't download my uploaded file back?
It turns out I should just use blob.UploadFile(fullLocalPathFileName) instead of blob.UploadFromStream(stream). You can get the full local path of your file from the MultipartFormDataStreamProvider and just send it easily to the blob.

Resources