Get Widget by ID
The ID of the widget to retrieve
Request
Authentication
Requires an active session. Users can only access widgets from their own projects.Response
Indicates if the operation was successful
The widget object containing all configuration and data
Unique widget identifier
ID of the project this widget belongs to
Widget type (e.g., “DataTable”, “Chart”, “TextBlock”)
Widget subtype for specialized configurations
Widget title
Optional widget description
Widget-specific configuration object (varies by widget type)
SQL query for data-driven widgets
ID of the database connection used by this widget
ISO timestamp of widget creation
ISO timestamp of last widget update
Example
Users can only access widgets that belong to projects they own. The API checks project ownership through the session user ID.
Widget Management via Server Actions
While the HTTP API only provides read access to widgets, widget creation, updates, and deletion are handled through Next.js Server Actions:Available Server Actions
upsertWidgetAction
Create a new widget or update an existing one
deleteWidgetAction
Delete a widget by ID
Why Server Actions?
VizBoard uses Next.js Server Actions for write operations (create, update, delete) because they provide:- Built-in CSRF protection
- Seamless integration with React Server Components
- Automatic revalidation of cached data
- Type-safe function calls from the client
