Skip to content

PUT /api/v1/meta/:type/:name is hard to discover — add a POST convenience alias #2684

Description

@akarma-synetal

Problem

The save endpoint for metadata items is registered as PUT /api/v1/meta/:type/:name in packages/rest/src/rest-server.ts. This is correct REST semantics, but creates discoverability friction:

  1. Only PUT is accepted. Many API clients and tools default to POST (Postman defaults, fetch with body, curl -d). Sending a POST to the correct path returns a generic 404 with no hint that PUT is the expected method.

  2. No helpful error when :name is missing. A request like POST /api/v1/meta/view/?mode=draft (trailing slash, missing name segment) doesn't match /:type/:name and returns {"error":"Not found"}. Callers have no way to distinguish "route doesn't exist" from "URL is malformed."

Proposed solution

A. Register a POST alias in registerMetadataEndpoints() (at packages/rest/src/rest-server.ts ~line 2746) that delegates to the same handler as the PUT route. This is safe because:

  • Sub-routes (/publish, /rollback) are already registered as more-specific POST paths that match first
  • The handler uses ?mode=draft query param (not HTTP method) to distinguish draft saves

B. Optionally register a descriptive error handler on /:type alone so that incomplete URLs return a useful message instead of a generic 404.

Expected outcome

# Before
$ curl -X POST http://localhost:8080/api/v1/meta/view/my_view?mode=draft -d '{}'
{"error":"Not found"}

# After
$ curl -X POST http://localhost:8080/api/v1/meta/view/my_view?mode=draft -d '{}'
{"name":"my_view", ...}   # works via POST alias

Where

packages/rest/src/rest-server.tsregisterMetadataEndpoints(), PUT handler around line 2746

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions