Watch entities
This shows how to use the SDK to fetch entities from Lattice and stream real-time information about entity components.
Complete the steps to learn how to use the following APIs:
GetEntity— Retrieves a single entity from Lattice.StreamEntities— Establishes a persistent connection to stream entity events.
Before you begin
- To configure your app to watch entities, set up the Lattice SDK.
- Learn about required components and various entity shapes in Lattice.
gRPC authentication
If you are using gRPC with client credentials, set up the token refresh module before running the examples on this page.
Get an entity
Get details of a specific entity using entity_ID
and the GetEntity API:
Get the entity ID
Open the Lattice UI and find the entity in the Entity Explorer. Copy its ID from the Entity ID column:

Stream entities
The StreamEntities API establishes a
persistent connection to stream entity events as they occur. The stream sends two types
of events: entity
and heartbeat.
Use the following optional parameters to control
the frequency and type of data fetched from your environment:
heartbeatIntervalMS,
preExistingOnly,
and componentsToInclude.
To stream entities from Lattice, do the following:
Stream all components
To get stream of all entity components from your environment, including new entities as they are updated, use the default options.
By default, the preExistingOnly option is set to false, instructing
Lattice to establish a persistent, real-time connection with the client:
If successful, you get a stream of all entities as they are updated in Lattice:
Stream specific components
Use componentsToInclude and provide a list of components in snake_case.
For example, aliases, and location_uncertainty:
If you’re directly invoking the streamEntities REST API using curl or another
similar tool, you must list the components using camelCase: locationUncertainty.
If successful, you receive a real-time stream of entities with aliases populated:
What’s next?
- Learn more about the Entities API in REST and gRPC.
- Learn how to Publish entities to Lattice.
- Check out the Lattice sample apps.