API Unification RFC #888
Replies: 3 comments 9 replies
-
I think we need to split this into multiple suggestions |
Beta Was this translation helpful? Give feedback.
-
Wrapping meaningful data to What I'd like to add, quickly checked and didn't find bad examples, but we should keep it that way:
This leads me to your 6. point, I think we should keep number of those kind of endpoints to the minimum, or try and order those under our regular paths, wherever it makes sense. Don't want to hammer the cube in the round hole, but your example, |
Beta Was this translation helpful? Give feedback.
-
I agree with the suggestions, perhaps to split it into smaller chunks we could start by refactoring each endpoints in routes individually in the new module architecture. However, how do you see organizing for multiple api versions? Previously the idea was to put everything under |
Beta Was this translation helpful? Give feedback.
-
Summary
This RFC proposes a unified approach to designing and structuring the API across the application. The goal is to improve consistency, clarity, and maintainability by standardizing endpoint naming, response formats, and resource access patterns. The proposal focuses on reducing ambiguity, avoiding deep resource nesting, and ensuring uniform permission handling.
Motivation
Currently, the API has inconsistencies that make it harder to use, maintain, and extend. Different endpoints follow varying conventions, response structures are inconsistent, and some routes rely on implicit assumptions (e.g., defaulting to the current user's context without explicit parameters). These inconsistencies lead to confusion, increased development time, and potential security issues.
The key motivations for this unification are:
Examples
Below are examples highlighting existing issues and the proposed unified approach.
Example 1: Providers List Retrieval
Current:
Response:
Proposed:
Response:
data
field for all list endpoints.Example 2: Templates List Retrieval
Current:
Response:
-list
suffix.Proposed:
Example 3: User Settings Update (Permissions Use Case)
Current:
Proposed:
:userId
.Example 4: Template Retrieval with Filters (Relation Filtering via Query Parameters)
Current:
Proposed:
/users/:userId/templates
.userId
andfavorite
can be provided but are not required.userId
, the endpoint returns results filtered by the caller’s permissions. IncludinguserId
enables scenarios like admin views or organization-wide access.Example 5: Template Creation (Mutation Standardization)
Current:
Proposed:
Example 6: Business Flow Commands (Command-like Endpoints)
While the goal is to standardize around resource-based endpoints, there are cases where command-like endpoints are more appropriate. These endpoints represent actions or business flows where the resource context is not clear or is secondary.
Example:
Next Steps
This unified approach will enhance the developer experience, improve maintainability, and ensure the API is scalable and secure for future needs. Feedback and suggestions are welcome!
Beta Was this translation helpful? Give feedback.
All reactions