Reputation: 1970
I have been using v2 of the Box API to get the events of individual users. Recently I read about the provisioning of admin_logs
in v2 API that provide the logs for all users solely from the auth_token of the admin. I wanted to give that a try and found the following issue:
The admin_logs
API response does not carry any stream_position
, unlike the normal user API. How can the client then reliably get all the logs? One obvious way is to use the returned chunk-size
as the offset in the next call to the API. Is this a reliable approach?
Also, what about the consideration of duplicate logs. The normal user API was prone to sending duplicate logs as suggested by the Box documentation. I catered for it in my application. But now for the admin_logs
there is no stream position. Does that mean that there will be no duplicate logs in the admin_logs
responses? Will the offsets guarantee that no duplicates are returned?
Also, how will long polling work in the case of admin_logs
? I tried to fetch a long poll URL using admin auth_token with the admin_logs
specifier
curl -XOPTIONS https://api.box.com/2.0/events?stream_type=admin_logs
but this returns a 500 internal_server_error
.
When this failed I tried to get a long polling URL with admin auth_token but without the admin_logs
specifier
curl -XOPTIONS https://api.box.com/2.0/events
this call is successful and returns a long poll URL but unfortunately I do NOT get the updates of all users on this polling URL. Seems like it only reports the events for that specific admin. Is there any way to enable long-polling on admin_logs
?
Upvotes: 1
Views: 757
Reputation: 8035
How can the client then reliably get all the logs?
Enterprise events use the created_before
and created_after
properties in place of the stream_position
. The created_after
property is a close analog of stream_position
.
What about the consideration of duplicate logs?
You may receive duplicate enterprise events. You can use the event_id
to ensure that you have a distinct set of records.
EDIT
How will long polling work in the case of
admin_logs
?
Per seanrose below, long-polling of enterprise events is a work in progress.
Upvotes: 2