Skip to content

api: deprecate legacy endpoints used by pycore; drop other legacy endpoints; enable DRF/OpenAPI api - #454

Merged
mik3y merged 9 commits into
mainfrom
mikey/legacy-api
Aug 3, 2026
Merged

api: deprecate legacy endpoints used by pycore; drop other legacy endpoints; enable DRF/OpenAPI api#454
mik3y merged 9 commits into
mainfrom
mikey/legacy-api

Conversation

@mik3y

@mik3y mik3y commented Aug 3, 2026

Copy link
Copy Markdown
Member

Part of #452 and the goal of moving us to a cleaner, easier to use & maintain API.

This removes and 401s a bunch of endpoints that were only in use by the Kegbot Android app, which will no longer be supported. A replacement app could someday be built against the new APIs, but I have no current plans to.

It continues support for endpoints which are needed by @kegbot/kegbot-pycore, as a transitional aid.

It enables the django-rest-framework API and mounts it at /api/, and with OpenAPI docs at /api/docs

mik3y added 9 commits August 3, 2026 13:28
- Drink.cancel_drink deletes the record and returns nothing, but the
  view tried to serialize its return value; serialize the drink before
  canceling instead
- pins the exact legacy-api surface kegbot-pycore (and the fullscreen
  page) depend on, ahead of deprecating everything else
- legacy responses are now built as plain dicts (pykeg.web.api.serialize)
  with the same field names and presence rules the proto encoding
  produced; fields the old encoding marked deprecated are dropped
- api exceptions move to pykeg.web.api.exceptions; pykeg.proto is gone
  and the protobuf dependency (and last tie to kegbot-api) with it
- only the endpoints kegbot-pycore calls remain (status, taps,
  record/cancel drink, thermo logging, auth-token lookup, controller
  and flow-meter creation), plus the events feed the fullscreen page
  polls; every other route answers 410 Gone
- the device-link flow (api + kegadmin page) is removed along with the
  other app-only endpoints
- every v1 response carries a Deprecation header
- changelog notes the trim, the 410s, and the mobile-app impact
- the drf api is always enabled (KEGBOT_ENABLE_V2_API is gone) and owns
  the /api/ namespace
- the deprecated legacy api moves exclusively to /api/v1/; pycore
  installs must configure their api url accordingly
- privacy, setup-gate, and slash-rewrite middleware follow the new
  prefixes
- close write-permission holes: users and invitations are read-only,
  beverages/producers need admin to write, notification settings are
  scoped to the caller, plugin data (may hold plugin credentials) is
  admin-only, thermologs are read-only
- fix InvitationViewSet serving the wrong serializer
- api keys created via the api bind to the caller; key value is
  server-generated (read-only)
- nested and method-sourced serializer fields are marked read-only;
  beverages accept producer_id on write
- login goes through django authenticate(), honoring auth backends and
  inactive-user checks
- schema served at /api/schema, interactive docs at /api/docs (swagger
  ui assets bundled via the sidecar package; no cdn)
- schema validates with --fail-on-warn: auth scheme described via an
  extension, method fields carry type hints
- pykeg.api is now a proper installed app (label pykeg_api; the label
  'api' belongs to the legacy pykeg.web.api)
@mik3y
mik3y force-pushed the mikey/legacy-api branch from 572d1d5 to f6ff560 Compare August 3, 2026 20:29
@mik3y
mik3y merged commit ae928ad into main Aug 3, 2026
6 checks passed
@mik3y
mik3y deleted the mikey/legacy-api branch August 3, 2026 22:38
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