Browsing events within a tenant is exposed through the
List Tenant Events
API.This guide explains how to use the tenant feed API perform a full export
of all results.
It is possible to save the next in a database and use it to resume fetching new results in the future.
However, it is important that future requests use exactly the same parameters for everything else but next.
For performance reasons, feed results only contain the bare minimum.
To get the full data, an API call must be made per result to the
Retrieve Event
endpoint.
If you’re looking to export the events of a single identifier, refer to the
List Identifier Events
endpoint.
Copy
Ask AI
# (incomplete example)# ID of the identifier for which we want to list the events.identifier_id: int = 12345for resp in api_client.scroll( method="POST", url=f"/firework/v4/events/identifiers/{identifier_id}/_search", json={ "from": last_from, },): ...
# (incomplete example)# ID of the identifier group for which we want to list the events.identifier_group_id: int = 12345for resp in api_client.scroll( method="POST", url=f"/firework/v4/events/identifier_groups/{identifier_group_id}/_search", json={ "from": last_from, },): ...
These are end-to-end examples in various programming languages.
Python SDK Example
Copy
Ask AI
import timefrom flareio import FlareApiClientapi_client = FlareApiClient.from_env()last_from: str | None = Nonefetched_pages: int = 0for resp in api_client.scroll( method="POST", url="/firework/v4/events/tenant/_search", json={ "from": last_from, },): # Rate limiting (search). time.sleep(1) resp_data: dict = resp.json() fetched_pages += 1 num_results: int = len(resp_data["items"]) print(f"Fetched page {fetched_pages} with {num_results} results...") # Save the last "next" value. last_from = resp_data.get("next") or last_from # (Optional): Get the full data for item in resp_data["items"]: # Rate limiting (default). time.sleep(0.25) event_response = api_client.get( url="/firework/v2/activities/", params={ "uid": item["metadata"]["uid"], }, ) full_data = event_response.json() print(f"Here is the full data of the event: {full_data}")print(f"The next execution could resume using {last_from=}.")