Spring Boot Best Practices

1.1 Resource Identification


GET     - /users        - Returns a list of users
GET     - users/{id}    - Returns a specific user
POST    - /users        - Create a new user
PUT     - /users/{id}   - Updates a specific user
DELETE  - /users/{id}   - Deletes a specific user

1.2 Use Proper HTTP Headers for Serialization Formats


Content-Type defines the request format.
Accept defines a list of acceptable response formats.

1.3 Dont't use GET


Get Method and Query Parameters Should Not Alter the State
GET /activities/12?activate 
GET /activities/12/activate

1.4 HTTP Response Status Codes


200 OK
201 Created
400 Bad Request
401 Unauthorized
403 Forbidden
404 Not Found
405 Method not allowed
406 Not acceptable
407 Proxy authentication required
408 Request timeout
409 Conflict
410 Gone
415 Unsupported media type
500 Internal Server Error
502 Bad gateway