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.
Related
Is there a way to use the Dropbox API to list docs in a Paper folder?
There isn't a way to list all Paper documents in a specific folder directly, but I'll pass this along as a feature request.
The closest thing is to use /2/paper/docs/list[/continue], which let you list all of the Paper documents the user has either accessed (filter_by=docs_accessed) or created (filter_by=docs_created).
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.
I'm designing RESTful API for file storage and having problems with finding the best way to organize URL's to actions.
Files can be grouped to folders but it is needed to be able to get all the files.
Guidelines suggests to use the following url to get files for specific folder.
GET /folders/{folderName}/files
But what should be used to just get all files? GET /files or GET /folders/files?
Also Google Drive has somewhat similar functionality and they use diifferent approach
GET files/{folderName}/children
As you've noticed this can range from one API designer to another.
If I was facing this problem I would want to consider all use cases and figure out what works best.
It looks like the following would meet your needs:
GET / Retrieves all files and folders
GET /{folderId} Retrieves all contents of said folderId (folders and files)
GET /{fileId} Retrieves the file
GET /{folderId}/{folderId} Same as above, but for nested folder
GET /{folderId}/{folderId}/{fileId} Retrieves the file
this pattern can continue for however nested the file structure is (note there is a limit on URL length)
Then if you have a unique requirement such as all you just create a new api endpoint.
GET /files/ Retrieves all files
GET /files/?filter="*.txt" Retrieves all text files
So to answer your EXACT question of:
But what should be used to just get all files? GET /files or GET
/folders/files
I would lean towards /files instead of /folders/files. /folders/files does not make much sense as an api consumer.
I am using the REST API for OneDrive. I have a name of a file in the users storage. I want to obtain the properties for this file. According the documentation file's properties can be retrieved
if you have the file ID.(http://msdn.microsoft.com/en-us/library/dn659731.aspx) So I need the file ID and the only way I see to obtain it is to search the whole storage which is really unnecessary.
Is there a way to find properties of a file(with a known name) with a single request to the service?
Ideally the API would support access by path which would do what you require (assuming you have the full path and not just the name). Unfortunately, to my knowledge that isn't supported.
There is a heavy handed approach that may work for you though - you can use the search capabilities of the API to find files with the name you specify:
GET /[userid]/skydrive/search?q=MyVideo.mp4
The documentation is available at the link below:
http://msdn.microsoft.com/en-us/library/dn631847.aspx
I need to get Google search results for particular filetypes.
For example, in browser I would directly google search for "hyperloop filetype:pdf" and it will list out PDF files for "Hyperloop".
For this, my Google Custom Search request URI will be https://www.googleapis.com/customsearch/v1?key=MY_KEY&cx=MY_UNIQUE_ID&q=hyperloop&fileType=pdf
However, currently I would like to get search results for "hyperloop" of filetypes .ppt or .doc.
In browser, I would achieve this by googling "hyperloop filetype:ppt OR filetype:doc".
What will be my Search request URI equivalent for this query?
I could not find anything related to querying using multiple values for a single parameter in Google Custom Search Documentation.
Rather than doing
q=hyerloop&filetype=pdf
you can use
q=hyperloop%20filetype:pdf%20OR%20filetype:doc
use this its work
$url='https://www.googleapis.com/customsearch/v1?key=AIzaSyCJUGIb_tevRKD-Kxxi5f4&cx=010407088:onjj7gscy2g&q='. urlencode($keywords).'&filetype=doc&filetype=docx';
for me