How to set the creation date on Google Drive SDK - google-drive-api

I have a file created a while ago that I want to upload on Google Drive, while preserving it's original creation date.
How to do that with the Google Drive SDK?

The API reference says that the createdDate JSON property is not writable. But in at least the JAVA library, you have a method setCreatedDate() that can be use to set this property to your convenience.
However, I've just tried to do that with the API explorer, and the API returned me a 400 error - Bad request. So i think this is not possible
Jérôme

Related

Is there any API to get metadata schema for Google Drive rest API

On Google Drive documentation I could see schema for individual resources like File,Permissions etc but no where mentioned about API for meat data of all resources.
The Discovery Service API is an interesting if little known API it gives you all the information you could ever need about Google APIs.
If you take the following command and place it in a web browser you will see everything you could ever want to know about the Google Drive API v3.
https://www.googleapis.com/discovery/v1/apis/drive/v3/rest

Convert docx to gdoc ( OpenWithLinks = null ) [duplicate]

I am hoping to programatically open a drive file with a particular app using the Google drive APIs.
The aim is to mimic the GUI drive method of launching an app using the "Open With" context menu for a selected file.
While I can get a list of the available apps using apps list method, the app resource doesn't detail the Open URL as far as I can work out.
Does anyone know if it is possible to obtain the Open URL using the APIs?
I believe if you have the scope set for drive.apps.readonly you should be able to use the File method getOpenWithLinks to discover the URLs. Just testing it now, the getOpenWithLinks method isn't available on the File class. I wonder if it has been deprecated? Certainly I can't find evidence of it being so.
https://developers.google.com/resources/api-libraries/documentation/drive/v2/java/latest/com/google/api/services/drive/model/File.html#getOpenWithLinks()
Revision: the getOpenWithLinks methods are available again in revision 75 of the v2 drive API.

Do you need to migrate to Drive API when using https://spreadsheets.google.com/feeds/

The 22nd of January, I received an email with the subject 'Important: Steps to migrate from discontinued Documents List API' from Google Apps .
Important: Steps to migrate from discontinued Documents List API
Hello administrators,
We recently communicated that Documents List API will be discontinued on April 20, 2015. This change means that service calls for this API will no longer be supported, and any Google Apps features that are implemented using this API will no longer function.
Our records indicate that you may have an application that uses Documents List API, and we recommend that you migrate to Drive API, which has comparable
functionality, as soon as possible.
Here's what you need to do:
Determine if you have an application that makes requests to these
types of URLs:
https://docs.google.com/feeds/
https://docs.googleusercontent.com/
https://spreadsheets.google.com/feeds/
Migrate the applications to Drive
API. If you have questions
about migration, please contact Google Apps for Work Support.
Sincerely, The Google Apps for Work Team
I think it says that applications using https://spreadsheets.google.com/feeds/ should migrate to the new Drive API. But in the new Drive API, this URL is used too:
https://developers.google.com/google-apps/spreadsheets/#sheets_api_urls_visibilities_and_projections
Is there a typo somewhere in the URL either in the email or Drive API documentation?
Or is this email saying that when you determined you used any of these URL's you're OK?
PS: I opened a case at Google but I fear a late response, so I asked here.
Short answer is no.
The Docslist API is being discontinued because it has been replaced by the Drive API. In the case of the Spreadsheet API, there is no replacement API (yet - maybe one day), so it remains supported.
The only gotcha is that at some point, only OAuth 2 will be supported for authentication/authorisation so if you're using OAuth 1 or u/p, you have some work to do.
The official Google response is that the Spreadsheets API will continue to function after the 20 April shutdown:
"Apologies for the confusing email. The sheets API is not yet deprecated and will continue to operate beyond the April shutdowns."
https://code.google.com/a/google.com/p/apps-api-issues/issues/detail?id=3709

Record all request uris/methods/response codes for Google Drive Java Client Library

I'm using the google client library to access the Google Drive API. I'd like to custom log all the request URI's, the request method as well as the response codes. Is there a built in mechanism to do this with the google client library?
Ideally, I could use the API as I am now and not have to modify each request but maybe add some sort of interceptor to the Drive object itself where I can record this data on every request that goes through this Drive service.
Any ideas?
Not sure that is exactly what you want but you could modify the log level of the API client in logging.properties
com.google.api.client.level = FINEST

Migrating to Drive SDK from DocumentsList API V3

I just came to know that DocumentsList API is depricated. So i thought of migrating my app to Drive and saw this page. I mostly use urls like https://docs.google.com/feeds/default/private/full/. So is it enough to replace them with new URL's like this https://www.googleapis.com/drive/v2/files/ ?
Just wanted to confirm is that all i need to takecare or am I missing anything. My App uses OAuth2 for authorization. Do I need to change anything in there too?
If you are constructing the requests yourself, you have to replace the URLs but also take into account that the responses from the Drive API will be JSON-formatted and not XML-formatted as in the Documents List API.
If instead you are using one of the Google-provided client libraries, you have to start using a newer client library, that you can download from https://developers.google.com/drive/downloads.
The migration guide is mostly a guide that maps methods from the Documents List API into methods of the Drive API and should be used as reference to know what is available and where.
Oauth 2.0 is fine. You can even use the same tokens you already have for Documents List v3.