API documentation below does not mention how to search based on the metadata. Is it really possible? Can someone point me to an example?
https://developers.box.com/docs/#search
thanks in advance! Milind
API documentation below does not mention how to search based on the metadata. Is it really possible? Can someone point me to an example?
https://developers.box.com/docs/#search
thanks in advance! Milind
Yes, it is possible. Here's an example provided, in Java, that comes straight from a member of the java-sdk Box group on Github.
BoxSearch boxSearch = new BoxSearch(api);
BoxSearchParameters searchParams = new BoxSearchParameters();
BoxMetadataFilter metadataFilter = new BoxMetadataFilter();
metadataFilter.setScope("enterprise");
metadataFilter.setTemplateKey("myTemplate");
metadataFilter.addFilter("myField", "fieldValue");
searchParams.setMetadataFilter(metadataFilter);
PartialCollection<BoxItem.Info> searchResults = boxSearch.searchRange(0, 100, searchParams);
A file cannot be searched for based on its metadata for at least 5-10 minutes after updating the file with the metadata that you're using to search for the file. Refer to the accepted solution on this forum question, that was posted to the Box community and answered by a "trusted contributor", for an explanation as to why this behavior occurs.
I had the same question and asked Box directly. This is the reply they sent me:
If you have an Enterprise account with Box they can set up custom metadata templates that can be searched via the
mdfilters
parameter, otherwise use thequery
parameter.