Listing Google Drive File name, Permission level in the same call? - permissions

Is there a way to list the google drive file name, and permission level in the same call?
I have been playing around with the Drive Api recently trying to do the following.
I am trying to take a folder id and then get the permissions on that folder id. Then list out the child objects in that folder.
I have been able to do that using the permission endpoint.
The problem I am seeing is when I list the children files in a folder, I only get the ids back. From there I run a loop over all those ids and then get my permission values back. But at that point there is no ID or File name in the result.
I used the Drive V2 permissions list endpoint
https://developers.google.com/drive/v2/reference/permissions/list
Here is an example of the json output.
https://gist.github.com/daguy666/c90cd9e94ca3845b5aab
Things I would love to get out of this one call.
User info (email / username)
Permission level
File name or File ID

Related

Microsoft Graph API to overwrite/delete permission for drive items

Is there any way to overwrite permission to share drive item to specific users only?
e.g.
Case 1:
File1 is shared with User1. I want to share File1 to User2 only using graph api which can also remove User1 from share list.
Currently, Graph APIs are available to add the permission and to delete permission separately.
But, I need to deal with a lot of files to update the permissions and for each file I need to take difference of permissions (User list already shared and User list needs to be updated to share item) for drive item to delete the permission to remove User from share list.
Case 2:
Another case is to make File private to the user. Is there any way to make file private directly(possibly single api call)?. Currently, I have to delete each user permission from shared list(5 calls to delete permissions if file is shared with 5 users). Again, I am dealing with a lot of files.
[Edited]
More info: My use case is for Direct Access permission and Not link-based permission.
According to your scenario, I think you can create a sharelink for a file by using the following API: /sites/{siteId}/drive/items/{itemId}/createLink and grant access to sharelink accordingly.
Refer to the documentation here on accessing shared drive items.
If this doesn't help, consider raising user voice for your specific scenario so that it goes into our backlog.

Can't get folder info by it's ID (Dropbox Api v2)

I have a problem with getting folder info by it's shared link / ID.
I have two users - the system user who calls the Dropbox API (ex. user A) and a regular user (ex. user B). I have a folder created by user B, user A is added to the members of this folder as owner. I have a link to this folder created by user B.
From user A through the Dropbox API calls I want to receive metadata of this folder, incl. its path, to be able to work with this folder (add / remove files, links, users, etc.).
To achieve this I:
Get folder link metadata (incl. folder ID like "id:a4ayc_80_OEAAAAAAAAAXz") using sharing/get_shared_link_metadata.
Get folder metadata using files/get_metadata with recieved folder ID as "path" parameter but in response I get the error "path/not_found/".
Why can't my system user A get information on the folder having its ID and being its member (owner)?

Difference between canEdit and canModifyContent

I'm using the Google Drive API to get data about a drive file with its fileID in order to tell if I can edit the file with the account that I set the credentials on the API.
However, I don't know which parameter should I use for this, the documentation for the API states that:
capabilities.canEdit: (boolean) Whether the current user can edit this file.
capabilities.canModifyContent: (boolean) Whether the current user can modify the content of this file
Are editing and modifying content the very same thing?

Stormpath, how to detect if user signed in with Google account?

It was super easy to integrate Google login for this fine tutorial:
https://stormpath.com/blog/build-nodejs-express-stormpath-app
I have to change the profile.jade file, so that givenName and surname are not displayed, if user has logged in with Google account.
The way it is now, if the user tries to change the 2 fields, the form response with error
Oops! We encountered an unexpected error. Please contact support and explain what you were doing at the time this error occurred.
This is to be expected, as those fields must be changed in Google account.
I'm able to access for any account via JSON:
"directory":{"href":"https://api.stormpath.com/v1/directories/49bXXXG8mAtthBTyE8ymdV"},
in my server.js file
req.user.directory
and I can look that up in Stormpath Admin panel, and it is indeed the Google directory. Then I can not display the 2 fields if a user belongs to that directory.
Is there a better way?
- like getting the name of the directory rather than the path?
Any suggestions are appreciate.

Marketo Rest API - Get Folder Token Type: Local, Inherited or Overridden

I've build a simple application to be able to create folder tokens using the Marketo REST API:
Marketo REST APIs: Get Tokens by Folder Id
From the Marketo Portal, I can see that inside a folder, tokens are grouped by type :
Local: tokens created inside the folder
Inherited: tokens that have been created in a parent folder.
Overridden: tokens that have been created in a parent folder but that the value has been overridden in the folder.
I would like to be able to group tokens in my application doing the same.
From Marketo documentation, I can't see any token type inside the Json result.
The only workaround I've found is to query both the folder and it parent folder so that I will be able to compare tokens and determine their types:
If the token doesn't exist in the parent folder, this is a local token.
If the token exists in the parent folder and has the same value, this is an inherited token.
If the token exists in the parent folder and has a different value, this is an overridden token.
I would like to know if there is any way to get the token type from the Json response without to query both folder and parent folder ?
Thanks in advance ^^
The token state can't be read from the response, so your best bet would be to to infer it in the manner you described.