How to exclude trashed files when listing files in google drive - api

I want to list all the files in google drive using google drive api v2 . But I want to exclude files in trash in the list
So I tried
GET https://www.googleapis.com/drive/v2/files?trashed=false
as suggested in the api documentation But still I get files in the trash folder ,Am I missing something ? Or is it a known bug in drive api?

Problem was with query syntax,
proper query parameter was
GET https://www.googleapis.com/drive/v2/files?q=trashed%3Dfalse

If some else also landed here trying to filter out Trashed file when using the Google Drive API, you can use setQ(args...) function like below,
FileList result = service.files().list()
.setQ("mimeType='image/jpeg' and trashed=false")
.setSpaces("drive")
.setFields("items(id, title)")
.execute();
More here - https://developers.google.com/drive/api/guides/search-files

Related

Exporting a list of images from Google Photos or DropBox as CSV

Do any of the major online photo storage/sharing platforms offer a reasonable way to export a set of image URLs and titles as something like a CSV or fetch them as JSON from a REST API?
I am trying to get any sort of clean list of title, url value pairs for all the images in a particular folder or gallery.
Google Drive/Photos would be my prefered platform, but I would switch to DropBox or other service if I could easily get such an export list.
If you're going to use Google Drive, you'll probably end up using these properties from File Resource:
webViewLink - a link for opening the file in a relevant Google editor
or
webContentLink - a link for downloading the content of the file in a
browser.
You can fetch this properties using files.list or files.get.
For Dropbox, you would use the /2/files/list_folder[/continue] endpoints to list the desired files:
https://www.dropbox.com/developers/documentation/http/documentation#files-list_folder
https://www.dropbox.com/developers/documentation/http/documentation#files-list_folder-continue
Then, you can use /2/sharing/create_shared_link_with_settings to create shared links for the desired files:
https://www.dropbox.com/developers/documentation/http/documentation#sharing-create_shared_link_with_settings
Or, to retrieve existing shared links, use /2/sharing/list_shared_links:
https://www.dropbox.com/developers/documentation/http/documentation#sharing-list_shared_links
Those are links to the documentation for the HTTPS endpoints themselves, but we recommend using one of the official SDKs if possible:
https://www.dropbox.com/developers/documentation
Those have corresponding native methods for the HTTPS endpoints.

Listing folders inside google drive using php api

I am using google Drive api ($files = $drive->files->listFiles ($parameters)) and it seems to return files that are not in folders, how can I access folders and their children and so of.
Files.list returns all files that's contained in your Drive API folder including those within subfolders. I've tried it myself. What maybe happening to you is that you have many files and for you to access the file, you need to use nextPageToken. And make sure you set the pageSize to 50 to display more files at a time.

dropbox API searchFileNames

Current Dropbox API searchFileNames() allows the searching of a query / substring, so if I wanted to look for filenames in a folder that were of a specific extension such as ".jpg", that works, but if I combine to look for ".jpg .png" I get nothing returned... as the documentation states 'A file matches only if it contains all the substrings.'
Is there another API that will allow a union of the searched vs the exclusion?
Thanks
No, the Dropbox API doesn't enable you to search for multiple file extensions at once like this, but I'll be sure to pass this along as a feature request.
As a workaround, you can split this into multiple API calls.

Can I search/get file by using File ID in Dropbox V2 API?

I'm using Dropbox V2 APIs (C#) to get files/folders from Dropbox account. I am able to fetch particular file/folder by using its specific path. I wanted to know whether there is any way I can fetch file/folder by using ID?
This depends on exactly which operation(s) you're referring to. For example, downloading files and getting metadata for files or folders support specifying file IDs:
https://www.dropbox.com/developers/documentation/http/documentation#files-download
https://www.dropbox.com/developers/documentation/http/documentation#files-get_metadata
You would specify the path as a string like "id:a4ayc_80_OEAAAAAAAAAYa".
Searching and listing folders currently do not support this though:
https://www.dropbox.com/developers/documentation/http/documentation#files-list_folder
https://www.dropbox.com/developers/documentation/http/documentation#files-search
The same applies to the corresponding methods in the SDKs.
Edit: list_folder and search now do support file IDs.

Is it possible to know the folder content? OneDrive

I wanna try OneDrive Api for Android and I was taking a look at the methods and possibilities this Api offers on this link and this other one but I don't see any way of listing the files a folder contains.
My App would need to upload some files to OneDrive, always using the same folder as root, say /MyFolder. The problem is that it only knows this root folder and all its content must be found out by means of recursive calls, that is, I list the files contained in /MyFolder and check if it's a folder or a file and in the first case list the files again it contains and so on.
Am I missing something or this Api doesn't provide such thing?
The Json object returned for a query against a Folder should contain a "data" property that is an array of children for the folder. You can see this in the interactive SDK (http://isdk.dev.live.com/dev/isdk/default.aspx) by playing with the "Reading Folder Properties" API.