Unify and manage your data

Search Entity Events with Cursor

The Search Entity Events with Cursor function returns the records matching a specified criteria with a strictly defined order.

The Search Entity Events with Cursor function works like a cursor in relational databases. When using this function, some character sequences are returned to the API user as a part of the response and all the subsequent requests with this cursor, then returns the next portion of data in the defined order. No data is repeated in the entire dataset that is returned.

This API endpoint does not check for long-term storage, hence, it will not 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
Consider the following examples:
  • 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
QueryoffsetNoThis represents the positive Integer value to identify which starting element in a result set must be returned in a response.offset=100
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
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.

Request

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

Response

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  "
    }
  ]
}

Consequent Request - get next data part

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

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  "
    }
  ]
}