Last active
February 14, 2021 09:31
-
-
Save BenjaminKlatt/ed080068cc510aa073587888cc56e010 to your computer and use it in GitHub Desktop.
Example User API for API Roundtrip
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@RequestMapping("/api/users") | |
@Tag(name = "User API", description = "User Management API") | |
interface UserApi { | |
@GetMapping | |
@ResponseStatus(code = HttpStatus.OK) | |
List<User> findAll(); | |
@GetMapping("/{id}") | |
@ResponseStatus(code = HttpStatus.OK) | |
User findById(@PathVariable String id); | |
@PostMapping | |
@ResponseStatus(code = HttpStatus.CREATED) | |
User save(@RequestBody User user); | |
@PutMapping("/{id}") | |
@ResponseStatus(code = HttpStatus.OK) | |
User update(@PathVariable String id, @RequestBody User user); | |
@DeleteMapping("/{id}") | |
@ResponseStatus(code = HttpStatus.NO_CONTENT) | |
void delete(@PathVariable String id); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment