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 your Lattice environment.
- Learn about required components and various entity shapes in Lattice.
Get an entity
Get details of a specific entity using entity_ID
and the GetEntity
API:
Copy the entity ID
Choose Copy Content from the drop down menu, then choose Copy Asset URL:

Extract the unique entity ID from this URL. For example, in the following,
the entity ID is YOUR_ENTITY_ID
:
https://your_lattice_url.com/c2/entities/YOUR_ENTITY_ID
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:
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.