Skip to content

API: Add v2 endpoints with query-parameter EIDs - #44

Merged
xsedla1o merged 5 commits into
masterfrom
feature/v2-api-query-param-eids
Jul 28, 2026
Merged

API: Add v2 endpoints with query-parameter EIDs#44
xsedla1o merged 5 commits into
masterfrom
feature/v2-api-query-param-eids

Conversation

@JakubMagda

Copy link
Copy Markdown
Collaborator
  • Add v2_router with EID passed as query parameter instead of path
  • Fixes 404 errors for EIDs containing '/' (e.g., IPv6 CIDR notation)
  • New endpoints under /entity/v2/ prefix
  • Add tests in tests/test_api/test_v2_api.py
  • Update docs/api.md with v2 API documentation
  • v1 API remains unchanged and functional

- Add v2_router with EID passed as query parameter instead of path
- Fixes 404 errors for EIDs containing '/' (e.g., IPv6 CIDR notation)
- New endpoints under /entity/v2/ prefix
- Add tests in tests/test_api/test_v2_api.py
- Update docs/api.md with v2 API documentation
- v1 API remains unchanged and functional
@JakubMagda
JakubMagda requested a review from xsedla1o July 28, 2026 14:08
xsedla1o added 4 commits July 28, 2026 22:23
The v1 entity router contains dynamic /{etype}/{eid} routes. While v2 is
mounted below /entity/v2, registering v1 first lets those catch-all routes
consume requests intended for v2 and interpret "v2" as an entity type.

Mount v2 first so its routes take precedence. Also accept entity GET and
DELETE requests without a trailing slash, avoiding redirects and supporting
both URL forms consistently.
Replace isolated TestClient smoke checks with the repository's unittest API
harness so the tests are discovered by the standard API test runner and
exercise the running API, worker, queue, and database together.

Create an entity whose string EID contains path separators, then verify its
read, update, TTL, and delete flows through v2. This proves query parameters
preserve the EID end to end instead of merely checking that routes do not
return 404. Keep datetime imports at module scope and cover validation plus
both trailing-slash forms.
Using /entity/v2 leaves the version marker inside the v1 namespace, where it
can conflict with dynamic /entity/{etype}/{eid} routes and makes correctness
depend on router registration order.

Move the endpoints to /v2/entity so the API versions have disjoint prefixes.
Update integration tests and documentation to use the new paths. Let curl
encode query parameters in the examples to demonstrate safe handling of EIDs
that contain URL-significant characters.
V1 and v2 differ only in whether EIDs arrive in the path or query, so delegate both route sets to shared handlers while preserving transport-specific validation.

@xsedla1o xsedla1o left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks for getting this started, good direction for the fix! I fixed any minor issues that were remaining.

@xsedla1o
xsedla1o merged commit 9742ca9 into master Jul 28, 2026
4 checks passed
@xsedla1o
xsedla1o deleted the feature/v2-api-query-param-eids branch July 28, 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.

2 participants