October 2024

Enhancements to Entity Service

4min

We have introduced two major enhancements to the Entity Service that streamline the process of updating entity states and attributes:

New API Changes

Single API for State Transitions and Attribute Updates

This enhancement allows developers to update both the state of an entity and its attributes in a single, idempotent API call. By combining both operations in a single request, this feature reduces the complexity of making multiple API calls and ensures atomic execution.

  • Introduction of a new stateTransition object within the API request body. Developers can now pass both properties and stateTransition objects in the same request body to update attributes and perform state transitions in a single call.
  • Two new response events for success and failure scenarios have been added:
    • EntityAttributeAndStateUpdationSuccessEvent
    • EntityAttributeAndStateUpdationFailedEvent
  • Two new fields for both success and failure events have been added:
    • eventCode: Code that represents the state transition event.
    • reasonCode: Justification for the state transition.

Conditional Updates Support to Entity Service

We have added support for conditional updates using JEXL expressions. This enables developers to apply updates to an entity's attributes only when certain conditions are met, providing more precise control over update logic.

  • Conditional Expression Support: Developers can now include conditional logic in their update requests using JEXL (Java Expression Language) syntax. This ensures that updates are only performed when specified conditions are met.
  • Batch Updates: Conditional updates extend to batch operations, allowing multiple entity instances to be updated within a single API call, with each instance having its own condition.

Documentation

To get started with these updates refer to the following documentation: