Hi @Priyanka Patil , I have received an update from internal team. Please find the response below.
Widget Position via API
- When you create a widget through the REST API, the row and column values in your request are saved directly in the database.
- The API does not perform any layout adjustment or auto-compaction (“gravity”) of widgets.
- This is why, immediately after creation, GET Dashboard returns the same row/column values that were submitted and saved in DB.
- e.g.: I created two widgets using the API (Widget A and Widget B) with Row 100, Column 1 and Row 200, Column 1. Since the rows are different for each widget, they were created without any exceptions and saved in the database as entered.
- The gravity / auto-compact / reflow logic is executed exclusively in the UI rendering layer.
- When you refresh the dashboard in the UI, the layout engine recalculates the widget positions to eliminate gaps and compact the layout. It then calls the internal API to save these updated positions to the database.
As a result, the widget appears in its new position in the UI, and if you call the GetDashboard API after this process, it will also return the updated position values.
Collision Exceptions
Because the API does not trigger gravity, if you attempt to create another 2 widgets at the same position (row 200, column 1), the API detects a collision and throws WidgetCollisionException.
This is expected and by design — the API cannot resolve layout conflicts automatically; only the UI reflow logic handles that.
Implication for Programmatic Widget Creation
Sequential widget creation via the API must use unique row/column positions to avoid collisions. There is no API endpoint to trigger gravity/reflow programmatically.
Please let me know if you need help with sequential widget creation via API.