Need to see if your shared folder is taking up space on your dropbox 👨💻? Find out how to check here.
Forum Discussion
Thang2000
3 years agoExplorer | Level 4
Search files in folder based on file tags python sdk
I'm trying to search files in a folder based on file tag, python SDK, yet encountering an error when trying to use my folder path:
from dropbox.files import SearchOptions
# search_op = SearchOptions() # this works but gives me everything from master folder
search_op = SearchOptions(path="/Thang Nguyen/Nano/Photos/Appurtenances/", max_results=10)
dm = dbx.files_search_v2(query="significant", options=search_op)
raise BadInputError(request_id, res.text)
dropbox.exceptions.BadInputError: BadInputError('58ddfa8a32824ea9b8e80882f2ef3a59', 'Error in call to API function "files/search_v2": invalid_argument')
Also, right now I'm passing in "query" and I'm assuming that would retrieve all files associate with "significant" keyword. How do I specify to search by tags only? Any code example would be a great help.
I also need to implement this function in Java.
2 Replies
- Здравко3 years agoLegendary | Level 20
Thang2000, you're getting that error because you have passed invalid argument - path in Dropbox (to either file or folder) cannot end in slash! That's it.
Hope this helps.
- Greg-DB3 years ago
Dropbox Community Moderator
Thang2000 As Здравко said, the error you're getting is because of the extra "/" you have at the end of your "path" value. Remove that extra slash to get that to work.
The Dropbox Java SDK offers the same search functionality.
As for searching by tags only, unfortunately the Dropbox API (regardless of which SDK you're using, if any) doesn't currently offer an option for restricting the search to match tag values only, but I'll pass this along as a feature request. I can't promise if or when that might be implemented though.
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
The Dropbox Community team is active from Monday to Friday. We try to respond to you as soon as we can, usually within 2 hours.
If you need more help you can view your support options (expected response time for an email or ticket is 24 hours), or contact us on X, Facebook or Instagram.
For more info on available support options for your Dropbox plan, see this article.
If you found the answer to your question in this Community thread, please 'like' the post to say thanks and to let us know it was useful!