Skip to content

improve API calls #819

@PythonFZ

Description

@PythonFZ

These calls happen on page load and could be deferred or combined.

  1. Authentication & Bootstrap (Required First)
Request Purpose Priority
POST /api/login Auto-login Critical
GET /api/user/role User permissions Critical
GET /api/version Version check Deferrable
GET /api/config/global-settings App config Critical
  1. Room Discovery & Creation
Request Purpose Priority
GET /api/rooms List rooms Critical
GET /api/rooms/default Default room info Critical
GET /api/rooms/template Template info Critical
POST /api/rooms/template/duplicate Create new room Critical
POST /api/rooms/{id}/join Join room Critical
GET /api/rooms/{id} Room details Critical
  1. Settings (5 SEPARATE REQUESTS - Combinable!)
Request Purpose Combine?
GET /api/rooms/{id}/settings/studio_lighting Lighting config Yes
GET /api/rooms/{id}/settings/camera Camera config Yes
GET /api/rooms/{id}/settings/pathtracing Pathtracing config Yes
GET /api/rooms/{id}/settings/property_inspector Property config Yes

Optimization: Create GET /api/rooms/{id}/settings returning all settings at once.

  1. Room State (7 SEPARATE REQUESTS - Combinable!)
Request Purpose Combine?
GET /api/rooms/{id}/figures Figures list Yes
GET /api/rooms/{id}/selections Selections Yes
GET /api/rooms/{id}/frame-selection Frame selection Yes
GET /api/rooms/{id}/step Current step Yes
GET /api/rooms/{id}/bookmarks Bookmarks Yes
GET /api/rooms/{id}/geometries Geometries Yes
GET /api/rooms/{id}/geometries/schemas Geometry schemas Deferrable

Optimization: Create GET /api/rooms/{id}/state returning all room state.

  1. Frame Data (6 SEPARATE REQUESTS - Already supports batching!)
Request Purpose
GET /api/rooms/{id}/frames/0/keys Available keys
GET /api/rooms/{id}/frames?indices=0&keys=cell Cell data
GET /api/rooms/{id}/frames?indices=0&keys=arrays.positions Positions
GET /api/rooms/{id}/frames?indices=0&keys=arrays.colors Colors
GET /api/rooms/{id}/frames?indices=0&keys=info.connectivity Connectivity
GET /api/rooms/{id}/frames?indices=0&keys=constraints Constraints
GET /api/rooms/{id}/frames?indices=0&keys=arrays.radii Radii

Optimization: The API already supports multiple keys! Change frontend to request:
GET
/api/rooms/{id}/frames?indices=0&keys=cell,arrays.positions,arrays.colors,info.connectivity,constraints,arrays.radii

  1. Deferrable/Low Priority
Request Purpose When to Load
GET /api/rooms/{id}/chat/messages Chat history After render
GET /api/rooms/{id}/filesystems Filesystems On demand
GET /api/file-browser/list File browser On demand

Summary of Optimizations

Optimization Requests Saved Implementation
Combine settings into one endpoint 4 → 1 Backend change
Combine room state into one endpoint 6 → 1 Backend change
Batch frame data keys in frontend 6 → 1 Frontend change
Defer chat/file-browser until after render -2 from critical path Frontend change

Total: 30+ requests → ~12 requests (60% reduction)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions