Repository navigation
Serve the endpoints supporting the UI under /api/ui, instead of /api/dev - #2578
Conversation
The dev blueprint was never under development: it holds the chart endpoints of FlexMeasures' own UI. Those now live in flexmeasures.api.ui, under /api/ui, and the UI calls them there. The /api/dev routes keep working, on the off chance that something outside FlexMeasures calls them, until FlexMeasures v2. The docs page now says these endpoints are not meant for external UIs. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0129WrXeJ5gia2pctFH93BqC Signed-off-by: F.N. Claessen <claessen@seita.nl>
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0129WrXeJ5gia2pctFH93BqC Signed-off-by: F.N. Claessen <claessen@seita.nl>
Documentation build overview
15 files changed ·
|
…rovements The session endpoints this branch adds move along with the rest of the former dev blueprint, to /api/ui/session, where the UI now calls them. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0129WrXeJ5gia2pctFH93BqC Signed-off-by: F.N. Claessen <claessen@seita.nl>
…g custom UIs The tutorial embedded a sensor chart from the endpoints supporting the UI, which are not meant for external UIs. It now embeds the toy building's chart from GET /api/v3_0/assets/<id>/chart, which shows the graphs set up for the asset. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0129WrXeJ5gia2pctFH93BqC Signed-off-by: F.N. Claessen <claessen@seita.nl>
This reverts commit 99aefcd, to keep this PR to the move of the blueprint: the tutorial keeps embedding a sensor chart, as the annotations page shows one too, and needs no new screenshot. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0129WrXeJ5gia2pctFH93BqC Signed-off-by: F.N. Claessen <claessen@seita.nl>
…ame the path of their chart attributes The specs describe the official API, so the generator now skips the views defined in flexmeasures.api.ui, under /api/ui and under their former /api/dev prefix alike. The graphs page's dataDevPath is now chartAttributesPath, after what it fetches. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0129WrXeJ5gia2pctFH93BqC Signed-off-by: F.N. Claessen <claessen@seita.nl>
There was a problem hiding this comment.
Copilot review overview
🔵 Needs a closer look
A docstring link in flexmeasures/api/ui/sensors.py points to a likely-nonexistent Sphinx anchor (sensor-(id)-...), which will break rendered documentation unless corrected.
Review effort: Lite
Findings: None
What changed in this PR
This PR introduces a dedicated flexmeasures.api.ui module for endpoints used by FlexMeasures’ own UI, serving them under /api/ui while keeping the legacy /api/dev routes working via legacy view subclasses.
Changes:
- Moved UI chart-support endpoints from
/api/devto/api/ui, and updated the UI graphs page to call the new prefix. - Kept
/api/devfunctional by registering legacy subclasses under the old prefix (planned removal in FlexMeasures v2). - Updated documentation (Sphinx API pages, tutorials, annotations docs) and added tests for the new UI-support endpoints.
| File | Description |
|---|---|
| flexmeasures/ui/templates/includes/graphs.html | Switch UI graph fetches from /api/dev to /api/ui for sensor/asset chart support endpoints |
| flexmeasures/ui/static/openapi-specs.json | Add empty-path entries for /api/ui/... endpoints (mirroring existing /api/dev/... placeholders) |
| flexmeasures/api/ui/tests/test_ui_support_api.py | Add tests covering /api/ui (and legacy /api/dev) sensor chart endpoints and UI chart attribute endpoints |
| flexmeasures/api/ui/tests/conftest.py | Rename fixture docstrings/prints from “dev” to “UI-support” |
| flexmeasures/api/ui/tests/__init__.py | Introduce test package init for flexmeasures.api.ui.tests |
| flexmeasures/api/ui/sensors.py | Update view docstrings for UI-support positioning; add legacy subclasses served under /api/dev |
| flexmeasures/api/ui/__init__.py | Register UI endpoints under /api/ui and legacy endpoints under /api/dev |
| flexmeasures/api/dev/__init__.py | Remove old dev registration entry point (routing now owned by flexmeasures.api.ui) |
| flexmeasures/api/__init__.py | Register the new UI-support endpoints module instead of the removed dev module |
| documentation/tut/building_uis.rst | Update tutorial examples/links to use /api/ui and clarify “not official API” status |
| documentation/index.rst | Replace api/dev toctree entry with api/ui |
| documentation/concepts/annotations.rst | Update sensor chart example path and documentation reference from dev to UI-support |
| documentation/changelog.rst | Add changelog entry announcing /api/dev → /api/ui move (legacy kept until v2) |
| documentation/api/ui.rst | Add new Sphinx page for UI-support endpoints |
| documentation/api/dev.rst | Remove old “Developer API” Sphinx page |
| documentation/api/change_log.rst | Add API changelog note about the /api/ui move |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
…provements Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0129WrXeJ5gia2pctFH93BqC Signed-off-by: F.N. Claessen <claessen@seita.nl>
Both links ended in a dash that the rendered anchors lack, and the tutorial's spelled the path parameter without its parentheses. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0129WrXeJ5gia2pctFH93BqC Signed-off-by: F.N. Claessen <claessen@seita.nl>
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
At least two new/updated Sphinx cross-references appear to use inconsistent qrefflask anchor formats (sensor-(id)-...), which is likely to break rendered documentation links.
Get a fresh assessment by requesting another Copilot review.
Review effort: Lite
Findings: 1
Open (1)
main moved the endpoint this branch fixed. PR #2578 took the UI-supporting endpoints out of /api/v3_0/assets and put them under /api/ui/session, where the accepted asset views are now one named constant, ASSET_VIEWS, shared by the new endpoint and the legacy one. The bug survived that move: the constant still omitted "Automations". Resolution: - Took main's side for flexmeasures/api/v3_0/assets.py and its tests, whose schemas and endpoints main removed, and for openapi-specs.json, which no longer documents these endpoints at all. - Re-applied the fix as "Automations" in ASSET_VIEWS, which now fixes the new and legacy endpoints at once, and moved onto it the note about staying in sync with the breadcrumb. - Kept this branch's `return` on both preference helpers while taking main's new /api/ui/session URLs and kebab-case fields. - Moved the API tests into flexmeasures/api/ui/tests/test_session.py beside main's, and the browser checks into test_ui_utils_helpers.py, reusing its CAPTURE_TOASTS snippet. Signed-off-by: Mohamed Belhsan Hmida <mohamedbelhsanhmida@gmail.com>

Description
The
/api/devblueprint at some point no longer became an API under development: it holds the chart endpoints that FlexMeasures' own UI calls. As discussed in #2554, this PR gives those endpoints a home named after what they do:flexmeasures.api.ui, served under/api/ui.GET /api/ui/sensor/<id>, with its/chart,/chart_dataand/chart_annotations, andGET /api/ui/asset/<id>replace their/api/devcounterparts, and the graphs page calls them there./api/devroutes keep working, on the off chance that something outside FlexMeasures calls them. They are thin subclasses of the moved views, registered under the old prefix, with a note in the code that the old prefix is to be dropped in FlexMeasures v2. No deprecation headers are sent, as there is no removal date yet.flexmeasures.api.dev.assetsmodule reference is gone./api/ui, and the tutorial's note says the sensor chart endpoint is not part of the official API.#2554 builds on this, by moving the session-preference endpoints it adds into the same blueprint.
How to test
pytest flexmeasures/api/ui: the sensor chart endpoints respond under both prefixes, and the chart attribute endpoints under/api/ui./api/ui.Further improvements
GET /api/v3_0/assets/<id>/chartand friends, with a new screenshot for the tutorial.Related Items
Part of #2554's discussion on where the endpoints supporting the UI belong.
🤖 Generated with Claude Code
https://claude.ai/code/session_0129WrXeJ5gia2pctFH93BqC