Skip to content

Non-standard HTTP: DELETE endpoints use request body instead of query params #809

@Tim020

Description

@Tim020

Problem

Several API controllers use non-standard HTTP by reading the resource ID from the request body in DELETE endpoints, rather than using query parameters.

Affected Controllers

The following controllers use escape.json_decode(self.request.body) in their DELETE methods:

  1. server/controllers/api/show/cast.py (line 135)
  2. server/controllers/api/show/microphones.py
  3. server/controllers/api/show/cues.py
  4. server/controllers/api/show/scenes.py
  5. server/controllers/api/show/characters.py
  6. server/controllers/api/show/acts.py
  7. server/controllers/api/show/script/stage_direction_styles.py (line 209)

Correct Pattern

The correct pattern is already used in server/controllers/api/show/script/revisions.py (line 193):

try:
    rev_id: int = int(self.get_query_argument("rev_id"))
except MissingArgumentError:
    self.set_status(400)
    await self.finish({"message": "Revision missing"})
    return

Proposed Solution

Update all affected controllers to use query parameters instead of request body for DELETE operations:

  • Change from: DELETE /api/v1/show/cast with body {"id": 123}
  • Change to: DELETE /api/v1/show/cast?id=123

This will require:

  1. Updating controller DELETE methods to use self.get_query_argument("id")
  2. Updating any frontend code that calls these endpoints
  3. Updating tests to pass IDs as query params

Benefits

  • Follows HTTP standards
  • Improves API consistency
  • Avoids issues with HTTP clients that don't support DELETE with body
  • Better RESTful API design

Metadata

Metadata

Assignees

No one assigned

    Labels

    claudeIssues created by Claude

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions