Status: Accepted Date: 2025-12-10 Context: Standardize REST API endpoint design across all microservices for consistency and maintainability.
The codebase had inconsistent REST API endpoint patterns across services:
/parse/resume) 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:
/candidates, /resumes, /job-specs/parse/resume, /admin/toggle/candidates, /resumes/candidate, /resumeGET /candidates?candidateId={id}GET /candidate/{email}/candidatesGET /candidates/{candidateId}GET /candidates?candidateId={id} (for single resource)GET /candidates?candidateId={uuid}GET /candidate/{email}/candidates200 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("/resumes")
@Consumes(MediaType.MULTIPART_FORM_DATA)
public Response createResume(@RestForm String candidateId, @RestForm FileUpload resume) {
// ... create logic
return Response.status(Response.Status.CREATED).entity(result).build();
}
@GET
@Path("/actor")
public Response getActor(
@QueryParam("actorId") String actorId) {
// ... query logic
return Response.ok(actors).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.
Positive: