Skip to content

Add simplified API v2 with single structure endpoint (#36)#68

Open
Titi211179 wants to merge 1 commit intoNeuralEnsemble:masterfrom
Titi211179:feature/api-v2-simplify
Open

Add simplified API v2 with single structure endpoint (#36)#68
Titi211179 wants to merge 1 commit intoNeuralEnsemble:masterfrom
Titi211179:feature/api-v2-simplify

Conversation

@Titi211179
Copy link

Addresses #36

This PR implements a simplified API v2 that reduces the number of
sequential calls needed to discover and access data in a file.

Current v1 flow (3+ calls)

  1. GET /api/v1/blockdata/ → block list + segment counts
  2. GET /api/v1/segmentdata/ → signal metadata for one segment
  3. GET /api/v1/analogsignaldata/ → actual signal data

Each call re-opens the file. Users must discover structure step by step.

New v2 flow (2 calls)

  1. GET /api/v2/structure/ → complete file hierarchy (blocks, segments,
    signal metadata, spike train metadata) in a single response
  2. GET /api/v2/data/analogsignal/ or /api/v2/data/spiketrains/ →
    actual data

Changes

  • New v2 data models: FileStructure, BlockStructure,
    SegmentStructure, SignalInfo, SpikeTrainInfo — rich metadata
    without payload data (sampling rate, duration, channel count,
    sample count)
  • New api/resources/v2.py with 3 endpoints: /structure/,
    /data/analogsignal/, /data/spiketrains/
  • v2 mounted at /api/v2/ prefix
  • v1 endpoints remain untouched for backward compatibility
  • Includes refresh_cache parameter from Add an option to the API to ignore/refresh the file cache #40
  • Clearer error messages with actual index values
  • Version bumped to 2.0

Example

GET /api/v2/structure/?url=https://example.com/data.nwb

Returns all blocks → segments → signal metadata in one response,
so the client knows exactly what to request next.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant