Search query on Metadata date attribute doesn't work
I'm using the Java Box API to make search queries on my box files.
The criteria of the query is the metadata value of the files, and specifically an attribute of Date type.
The mdfilters parameter for my query before encoding is this one:
[{"scope":"enterprise","filters":{"documentDate":{"gt":"20**removed**T02:00:**removed**:00"}},"templateKey":"myTemplate"}]
The request sent to Box API is this one (after encoding):
https://api.box.com/2.0/search?mdfilters=%5B%7B%22scope%22%3A%22enterprise%22%2C%22filters%22%3A%7B%22documentDate%22%3A%7B%22gt%22%3A%2220**removed**T02%3A00%3A**removed**%3A00%22%7D%7D%2C%22templateKey%22%3A%22myTemplate%22%7D%5D&type=file&ancestor_folder_ids=removed for privacy4&limit=200&offset=0
The result from the request is always this one, whatever the date specified:
{"total_count":0,"entries":[],"limit":200,"offset":0}
I'm sure that I have files matching the criteria of my query in Box, and when I call the API service GetMetadataOnFile on the expected results file, I have this answer:
{"$type":"myTemplate-8f0b59ac-f88c-425b-be65-d2f26fcc6734","$parent":"file_75221835282","$id":"4a84a04b-c5**removed**ddd-b61c-3a547bfaf5c1","$version":4,"$typeVersion":2,"attribute1":"VALUE 1","documentDate":"20**removed**T00:00:00.000Z","documentYear":"2016","attribute4":"VALUE 4","$template":"myTemplate","$scope":"enterprise_244868"} {"$type":"myTemplate-8f0b59ac-f88c-425b-be65-d2f26fcc6734","$parent":"file_75221835410","$id":"8967dac2-82**removed**ab-b56e-172a70be013c","$version":5,"$typeVersion":2,"attribute1":"VALUE 2","documentDate":"20**removed**T00:00:00.000Z","documentDescription":"Une description","documentYear":"2015","attribute4":"VALUE 4","$template":"myTemplate","$scope":"enterprise_244868"}
So, why does my query always return an empty list of files?
I have the same result if I use the operator "lt", or both operator "lt" and "gt".
Edit: It seems that whatever I do on this message, the date is removed from privacy.
The criteria is the 28/06/2016, formatted as an RFC3339 date : 20**removed** T 02:00:00 - 02:00
The expected metadata results are 22/07/2016 and 07/07/2016.
Please sign in to leave a comment.
Comments
0 comments