Is there any way to search for a file by sha1?
I have a test python application that can do the file search by name:
results = self.client.search(f_name, limit=200, offset=0)
but if I try to use query to look for the file by sha1 it just errors (or gives me any file that contains a number in the filename):
res = self.client.search("sha1=5c279fb05a2bd6d4886844c05b214fc88f71abd4", limit=200, offset=0)
Is this type of query not supported or did I just mess something up in the format?
-
We do not support searches for sha1.
Please refer to https://docs.box.com/reference#searching-for-content . The content_types field states that we only support searching by name, description, file_content, comments, or tags.
-
Thank you for the response; I had looked through that section of the documentation and was just curious since the sha1 can be seen as a rough approximation of the file_content or a standard tag. It seems very odd that your result object shows sha1 as a primary attribute of the file but it's not a searchable index.
Is there any plans for supporting features such as hash/metadata searching for a file?
-
I agree that the sha1 should be searchable. We create a tool that allows an InDesign user to place images from Box as actual http sources so they are not broken for others who work on the same document. The tool has an option that can help a user migrate to Box by uploading local images used in the document and setting their source to the Box location. The challenge we have is that a user could end up with a lot of duplicates of the same image if each upload went into its own folder. Ideally, we could search for the file by sha1 to find the exact same file, and link to that. Text searches don't guarantee a file is the same (multiple logo.jpg files might be in a Box account).
I'm sure there are other uses where matching a local file to its copy stored in Box could be useful.
Please sign in to leave a comment.
Comments
4 comments