API seach date range abnomal
AnsweredI'm writing a program to check file change everyday.
I try to use Box API to search for any file created or edit in a date range, E.g : 01/10/2018 - 31/10/2018.
first i try this link:
which return error 400:
{
"reason": "invalid_parameter",
"name": "to_search",
"message": "Invalid value ''."
}
and when i try this link (remove '&' before update_at_range):
which return data, but result is missing (the file i upload then rename is not in the results)
The account that provide access token have right to read folder content.
Did i do something wrong, or this is a bug?
What should i for desired results?
(I can not access enterprise events for private issues)
-
if you look at the search documentation (https://developer.box.com/reference#searching-for-content) , the `query` parameter is mandatory which is why you are having an issue with your first example as you have `query` set to blank.
In your 2nd example, you have just set the `query` parameter to 'updated_at_range=2018-10-01T00:00:00-07:00,2018-10-31T23:59:59-...' and are not actually using the `updated_at_range` parameter i believe.
From the documentation it seems like there is 1 exception for the `query` parameter to not be used and that's by using the `mdfilters` parameter which only searches for files that are associated with specific metadata templates. If all of the files you are looking for are associated with a set of specific metadata templates you may be able to use that along with the `updated_at_range` parameter.
Something like this :GET https://api.box.com/2.0/search?updated_at_range=2018-01-01T04:00:00+0000,2018-10-29T03:00:00+0000&mdfilters=[{"templateKey":"","scope":"enterprise","filters":{}}]
Please sign in to leave a comment.
Comments
2 comments