Date: 2025-12-10 Status: Accepted Context: Standardization of REST API endpoint design across all microservices
The codebase had inconsistent REST API endpoint patterns across services:
/parse/document) instead of resource-basedThis inconsistency made the API harder to understand, maintain, and extend. It also violated REST principles and industry best practices.
We will adopt RESTful API design standards based on RFC 7231, RESTful Web Services principles, and industry best practices. All endpoints across all services must follow these standards:
/entities, /documents, /resources/parse/document, /admin/toggle/entities, /documents/entity, /documentGET /entities?entityId={id}GET /entity/{email}/entitiesGET /entities/{entityId}GET /entities?entityId={id} (for single resource)GET /entities?entityId={uuid}GET /entity/{email}/entities200 OK - Success201 Created - Resource created successfully204 No Content - Success with no response body400 Bad Request - Validation errors401 Unauthorized - Authentication required404 Not Found - Resource not found422 Unprocessable Entity - Validation errors (more specific than 400)500 Internal Server Error - Server errorsPOST /auth/tokens/exchange with token in bodyGET /auth/token/exchange?token=xxx@POST
@Path("/documents")
@Consumes(MediaType.MULTIPART_FORM_DATA)
public Response createDocument(@RestForm String entityId, @RestForm FileUpload document) {
// ... create logic
return Response.status(Response.Status.CREATED).entity(result).build();
}
@GET
@Path("/entities")
public Response getEntities(
@QueryParam("entityId") String entityId) {
// ... query logic
return Response.ok(entities).build();
}
@PUT
@Path("/admin/features/{featureName}")
@Consumes(MediaType.APPLICATION_JSON)
public Response updateFeature(
@PathParam("featureName") String featureName,
Map<String, Object> request) {
// ... update logic
return Response.ok(result).build();
}
Authentication Endpoints: Authentication endpoints are an exception where action-based URLs are acceptable, as they represent authentication operations, not resource operations.
POST /auth/loginPOST /auth/registerPOST /auth/tokens/refreshPositive:
Decision Owner: Architecture Team
Review Cycle: Review annually or when significant new requirements emerge (e.g., HATEOAS implementation)