Skip to content

Serve the endpoints supporting the UI under /api/ui, instead of /api/dev - #2578

Merged
Flix6x merged 6 commits into
mainfrom
feat/ui-support-blueprint
Sep 22, 2026
Merged

Flix6x merged 6 commits into
mainfrom
feat/ui-support-blueprint

Conversation

@Flix6x

@Flix6x Flix6x commented Sep 22, 2026 •

Copy link
Copy Markdown
Member

Description

The /api/dev blueprint 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_data and /chart_annotations, and GET /api/ui/asset/<id> replace their /api/dev counterparts, and the graphs page calls them there.
  • The /api/dev routes 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.
  • The Sphinx page (formerly Developer API) is now UI-support endpoints, and says they are not part of the official API, and not meant for external UIs. The stale flexmeasures.api.dev.assets module reference is gone.
  • The tutorial on building custom UIs and the annotations page now point to /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.
  • Open a sensor or asset page: its graphs load from /api/ui.

Further improvements

  • The tutorial on building custom UIs and the annotations page still show a sensor chart from this blueprint, which sits uneasily with "not meant for external UIs". A follow-up could move both to the official asset chart endpoints, GET /api/v3_0/assets/<id>/chart and friends, with a new screenshot for the tutorial.

Related Items

Part of #2554's discussion on where the endpoints supporting the UI belong.


  • I agree to contribute to the project under Apache 2 License.
  • To the best of my knowledge, this PR does not contain any code that was not written by me, co-authored by me, or from other sources which allow redistributing.

🤖 Generated with Claude Code

https://claude.ai/code/session_0129WrXeJ5gia2pctFH93BqC

Flix6x and others added 2 commits September 22, 2026 09:25
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>
@read-the-docs-community

read-the-docs-community Bot commented Sep 22, 2026 •

Copy link
Copy Markdown

Flix6x added a commit that referenced this pull request Sep 22, 2026
…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>
@Flix6x Flix6x mentioned this pull request Sep 22, 2026
16 tasks done
…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>
@Flix6x Flix6x self-assigned this Sep 22, 2026
@Flix6x Flix6x added this to the 1.1.0 milestone Sep 22, 2026
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>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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/dev to /api/ui, and updated the UI graphs page to call the new prefix.
  • Kept /api/dev functional 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.

Flix6x added a commit that referenced this pull request Sep 22, 2026
…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>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 Low severity

Open (1)

Comment thread documentation/tut/building_uis.rst Resolved
@Flix6x
Flix6x merged commit eeacd84 into main Sep 22, 2026
14 checks passed
@Flix6x
Flix6x deleted the feat/ui-support-blueprint branch September 22, 2026 08:40
BelhsanHmida added a commit that referenced this pull request Sep 23, 2026
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants