Google Drive API for attaching files - google-api

We have old gdata libraries for Document List API and there is a method for Attchments. We are changing it to Drive API but we are ot finding anything related to attachments in Drive API. Do we have to use Files.insert instead? Please advise.

Related

How do you add a new API entry to the directory?

This is a surprisingly simple question, but I am unable to find the answer despite a solid search.
How are APIs added to the Google APIs Explorer Directory?
Google has an api called the google discovery services api this api contains a list of most of their apis
So by adding a record for a new api in descovery services it shows up in explorer
Only Developers at Google can add an entry to the Google API Directory

Access private document from google drive using google drive api

I am new to Google Drive API. I read on the google quickstart guide that we can access list of documents from our drive but can we do the same with the documents shared privately to us. Like if someone gave me view access of the document from their drive, Can I download it with Google drive API? I am trying to do this in a spring-boot application.
Yes, you can use Files.list() to list the files shared with you. To do so you should use the q parameter to filter those files. For example, you may use 'SaumyaShah#gmail.com' in readers if you want to list the files that have been shared with you. Here you can learn more about the q parameter. For further information about how to download those files, please follow this guide. Feel free to leave a comment if you still have doubts about these approaches.

What is "gapi.client.people.people.get"?

I'm reading this getting started document:
https://github.com/google/google-api-javascript-client/blob/master/docs/start.md
In Option1, the following code is written:
gapi.client.people.people.get({
'resourceName': 'people/me',
'requestMask.includeField': 'person.names'
})
Why .people.people? I want to know the details of this syntax. If I use google drive API, do I write gapi.client.drive.drive.get?
To answer this question lets start with the Discovery services api
The Discovery API provides a list of Google APIs for retrieving a machine-readable "Discovery document" metadata for each API.
The reason we are looking at this is because the Google apis js client library which you are using gapi was generated using the discovery services api. apis-client-generator
Then lets look at the discovery dock for people api
If you check under resources you get
contactGroups
contactGroups.Members
otherContacts
people
people.conversations
Then each resource has a group of methods under and the people resource has a method called get.
So people.people.get is actually {API}.{resource}.{method}
This is just how google chose to build up the API.
Now the google drive api also has a group of resources
About
Changes
Channels
Comments
Files
Permissions
Replies
Revisons
Drives
There is a method called gapi.client.drive.drives.get Which is drive api, drives resource, get method which will return a drives resource.
If your actually after files then its probably more like gapi.client.drive.files.get Which is drive api, files resource, file get method which would return a file resource.
From the API Discovery Document:
For each method defined in the API Discovery Document, a corresponding method is constructed on the gapi.client object.
For example, The People API's methods are under gapi.client.people.
The People API has the methods people.get and people.connections.list.
[T]he generated methods can be called as follows:
gapi.client.people.people.get(...)
gapi.client.people.people.connections.list(...)
You can view API Methods on APIs Explorer.
So .people.people means:
Using the People API-equivalent method people, call the people.get(...) method.
To use the Drive API v3, you would query against gapi.client.drive with your method name. For example, gapi.client.drive.channels.stop(...).
An important note from this answer: you must load the Drive API before using it.
gapi.client.load('drive', 'v3', callback);

Transferring ownership of a specific Google Doc file using google-api-ruby-client

I'm looking to transfer ownership of a specific Google Docs file using the Google Apps API. There are many accounts on a single Google Apps domain. There are many files I would like to transfer so I do not want to do it manually.
In the UI I've only seen the ability to transfer ownership of all files from a particular user rather than individual files.
I've looked through the GitHub page for the google-api-ruby-client gem, but I was unable to come up with a solution. Can someone point me in the right direction or post an example?
You'll need to use the Google Drive API. Specifically the Permissions "update" method.
First find/get the File ID, using the Files.List method, which will allow you to search using a query. Then use the Permissions.Update (or Patch) method, making sure to set the transferOwnership parameter to True.
Full documentation is here: Google Drive API - Permissions

google api javascript client Drive Api and access to Spreadsheets

if Google Drive API will be supported by access to Spreadsheet API
Or it's will be new Spreadsheet API like we have
https://developers.google.com/apis-explorer/#p/
Similar to developers.google.com/google-apps/spreadsheets/
https://code.google.com/p/google-api-javascript-client/
Google Drive API allows you to do CRUD (create,read, update,delete) functions to google drive. This is similar to the Google Documents List API for Google Docs and is the latest evolution. To actually edit or retrieve the contents inside a spreadsheet you must still use the Spreadsheet api which you listed above. The latest versions of the spreadsheet api also use Oath2 just like the Drive api.

Resources