Unify and manage your data

Show Page Sections

Search Entity Events with Cursor

Learn about searching for entity events with a cursor-based approach.

The Search Entity Events with Cursor operation allows you to retrieve entity event records in a strictly defined order using a cursor-based approach. It behaves similarly to cursors in relational databases. The first request returns a cursor value, which you include in subsequent requests to fetch the next portion of results. Each response continues where the last one left off, ensuring no duplication across the dataset.

This API endpoint doesn't check for long-term storage so it won't return any data older than 4 months.

Request:

POST {TenantURL}/entities/_events/_scan
Table 1. Parameters
Parameter RequiredDetailsExample
Headers Authorization YesThis represents the information about authentication access token in the format of "Bearer <accessToken>" (see details in Authentication API ).
Query filter NoThis enables events filtering by a condition. Format for the filter query parameter is, filter=({Condition Type}[AND/OR {Condition Type}]*)

To know more about the conditions, see Filtering Entities.

Note: Consider the following points:
  • Following are the fields and its values that are available for search:
    • timestamp
    • entity_type
    • entity_uri
    • eventType
  • The eventType field can have the following values:
    • ENTITY_CREATED
    • ENTITY_CHANGED
    • ENTITY_REMOVED
    • ENTITIES_MERGED
    • ENTITIES_MERGED_MANUALLY
    • ENTITIES_MERGED_ON_THE_FLY
    • ENTITIES_SPLITTED
    • ENTITIES_LOST_MERGE
    • ENTITY_REMOVED_GDPR
  • Filter by entity_uri: filter=(equals(entity_uri, 'entities/005ZBhp')
  • Filter by entityType: filter=(equals(entity_type, 'Organization')
  • Filter by event timestamp: filter=(gt(timestamp, 1373288685810) and lt(timestamp,1373288903390))
QuerytypesNoThis indicates a comma-separated list of event types using which events must be filtered. The possible values for the eventType field are as follows:
  • CREATED
  • UPDATED
  • DELETED
  • DELETED_GDPR
  • MERGED
  • MERGED_MANUALLY
  • MERGED_ON_THE_FLY
  • SPLITTED
  • ENTITY_LOST_MERGE
types=CREATED,UPDATED
QueryoptionsNoAn option for the endpoint to return:
  • resolveMergedEntities: Actual winner URIs for start/end objects. Loser URIs are resolved into winner URIs for all events, except for these merge operation events:
    • ENTITY_LOST_MERGE

    • MERGED MERGED_MANUALLY

    • MERGED_ON_THE_FLY

options=resolveMergedEntities
QueryoffsetNoZero-based index of the first event to return in the result set. For example, if the result set includes 1000 events and you set offset=100 and max=200, the operation returns events 101 through 300.

Ignored if you specify a cursor value in the request body.

offset=100
QuerymaxNoThis indicates the maximum number of events to be retrieved.
Note: You can specify a maximum value of 2000 for this parameter .
max=200
Request bodyCursor definition Yes for all requests except the first one.This indicates the JSON object that defines the cursor value and must have one JSON attribute cursor with the sub-JSON structure having one string attribute value. { "cursor": { "value": "cXVlcnlBbmRGZXRjaDsxOzE0NDI3OmpzdTdBNGNnUWU2YlBqc1JQbTlNbnc7MDs=" } }

Response:

Indicates a JSON object with the cursor specification and the response part.

First request

Here is a cursor-based request example:

POST {TenantURL}/entities/_events/_scan?filter=(gt(timestamp, 1373288685810) and lt(timestamp,1373288903390))

First Response

The response includes a cursor value to use in a subsequent request to continue retrieving the result set.

GET {TenantURL}/entities/_events/_scan?filter=(gt(timestamp, 1373288685810) and lt(timestamp,1373288903390)) Headers: Authorization: Bearer 204938ca-2cf7-44b0-b11a-1b4c59984512 { "cursor": { "value": "c2NhbjsxOzU5Okg5TkZ5UlVrUmJXOVh0NVp0LTVuSGc7MTt0b3RhbF9oaXRzOjQ7" }, "objects": [ { "type": "UPDATED", "timestamp": 1373288732189, "entity_uri": "entities/00tTuN7", "entity_type": "HCP", "label": " TheRipper0001" }, { "type": "UPDATED", "timestamp": 1373288732190, "entity_uri": "entities/00tTydN", "entity_type": "HCP", "label": " AAAAAAAAAAAAAA2 " } ] }

Follow-up request - get next data part

POST {TenantURL}/entities/_events/_scan Headers: Authorization: Bearer 204938ca-2cf7-44b0-b11a-1b4c59984512 { "cursor": { "value": "c2NhbjsxOzU5Okg5TkZ5UlVrUmJXOVh0NVp0LTVuSGc7MTt0b3RhbF9oaXRzOjQ7" } }

Follow-up response

POST {TenantURL}/entities/_events/_scan Headers: Authorization: Bearer 204938ca-2cf7-44b0-b11a-1b4c59984512 { "cursor": { "value": "c2NhbjsxOzU5Okg5TkZ5UlVrUmJXOVh0NVp0LTVuSGc7MTt0b3RhbF9oaXRzOjQ7" }, "objects": [ { "type": "UPDATED", "timestamp": 1373288829551, "entity_uri": "entities/00tTuN7", "entity_type": "HCP", "label": " TheRipper0001" }, { "type": "UPDATED", "timestamp": 1373288829551, "entity_uri": "entities/00tTydN", "entity_type": "HCP", "label": " AAAAAAAAAAAAAA3 " } ] }