Pull latest events using stream_position or created_after, created_before
I am interested in pulling the latest events according to time frame.
Example: First Api request: I use stream_position=0 to stream_position=123456 (assume)
It generates say 1000 events and I store them in my database. I store this stream_position for my next api requests.
Next api request I make after 2 hours and users performs some activity. Say 50 events.
Next API request: I use stream_position=123456 as the start of my request until next_stream_position.
Can i expect the only new records (say 50) to be returned.
- Will this approach work ? If not what approach will work.
- I explored create_after and created_before but that puts a limit on number of events to 500 and stream_position cannot be used with it as per api documentation.
- What is stream_position exactly. Does it relate to timestamp/latest revision and can be used in next API request call after 2 hours?
-
We use stream_position and store events in azure data warehouse. We then take out duplicates using event_id's because azure data warehouse allows for duplicate event_id's.
I believe there's always a little bit of duplicates using stream_position so if you're using a database, you can just make your event_id a key and it should work fine.
-
Thanks for reply.
So starting the stream_position directly (say 12356) during the next run until i read all entities/events would give me new set of events recently created?We will get duplicate events only on User events but not on Admin events. Correct ?
I see in documentation, When you request user events, Box delivers a low-latency, highly reliable list of all events related to the user's account. Because of its emphasis on returning complete results quickly, Box may return duplicate events, and events may delivered out of order.
サインインしてコメントを残してください。
コメント
3件のコメント