Search API only by date
Hello,
Is there currently a way to search for files by created at date only? I am trying the following:
search?query=&type=file&created_at_range=20**removed**T13:35:**removed**:00,20**removed**T13:35:**removed**:00&ancestor_folder_ids=removed for privacy0&limit=20
But it doesn't like the empty query. The endpoint does not support wildcards in the query so how can I get aroudn this and just get files created in that date range?
-
Since the query param is required, but the search is strictly by create date (or modify date), is there a wildcard we can simply pass for the query parameter? Or can you think of a value to pass that would be in ALL of the user's accessible files (even shared or enterprise content)?
Thanks,
AJ
-
One workaround would be to call the Enterprise Events endpoint and request Upload events. This will return all file upload events within your company's Box instance over the trailing 365 days. You can specify the needed date range using the created_after parameter.
-
Thanks for your response, .
I've given that endpoint a peek and it looks like something I could use to get the information. I see the note in the docs indicating that I must use an enterprise admin account to use it. My account (a "service account") has access to the admin console which indicates that it's set up as some sort of admin, but I don't think it qualifies as the enterprise admin account.
When I call the endpoint, I get an error message that seems to support this:
{"Bearer realm=\"Service\", error=\"insufficient_scope\", error_description=\"The request requires higher privileges than provided by the access token.\""}
I'm going to ask my operations team if I can use a more priviledged account for my service, but I'm not hopeful that they will allow it (and it doesn't feel like a best practice to use a super-special-enterprise-admin account for a service that just needs to query for recent files).
While I await a response from my team, can you think of another option that might work here?
Thanks again.
EDIT: When in the Admin Console, in the right column under "Account Information", it indicates that my account is a "CO-ADMIN". Shouldn't this be sufficient to query the enterprise event stream?
Please sign in to leave a comment.
Comments
8 comments