Network Fetch
Network fetch is the API path for browsing items across registered instances.
sequenceDiagram
participant Client
participant API as This Instance
participant Redis
participant PeerA as Peer Instance A
participant PeerB as Peer Instance B
Client->>API: GET /api/v1/network/item/fetch
API->>Redis: Check merged result cache
alt Cache hit (TTL from network config)
Redis-->>API: Cached merged items
API-->>Client: 200 merged items
else Cache miss
API->>PeerA: HEAD /count (check item count)
API->>PeerB: HEAD /count (check item count)
PeerA-->>API: count: 42
PeerB-->>API: count: 0
Note over API: Skip peers with count = 0
API->>PeerA: GET slice
PeerA-->>API: Items array
API->>Redis: Store merged result (TTL)
API-->>Client: 200 merged items
end
Public Route
Section titled “Public Route”GET /api/v1/network/item/fetchThis route:
- loads the requested network config
- checks the requested domain exists
- discovers registered instances for that domain
- asks each instance for local counts
- excludes zero-result instances
- builds a page plan
- fetches only the needed slices
- merges the result
- caches counts/pages in Redis
Internal Instance Routes
Section titled “Internal Instance Routes”POST /api/v1/network/item/count_localPOST /api/v1/network/item/fetch_localThese are server-to-server helpers used by the aggregator. They are scoped by SERVED_DOMAINS, so an instance only answers for domains it serves.
Cache Policy
Section titled “Cache Policy”The query may include cache_ttl_seconds, but runtime cache behavior honors the domain’s minimum_cache_ttl_seconds from the network schema.
Use the domain cache value to prevent clients from forcing overly aggressive refreshes across a network.
When To Use Local vs Network Fetch
Section titled “When To Use Local vs Network Fetch”Use local fetch for:
- “my items”
- owner-specific dashboards
- current instance administration
Use network fetch for:
- public discovery
- cross-instance search
- marketplace/network browsing
- map/list views across peer instances