개발 공부/Spring
[SpringBoot] REST API - DELETE
journey
2022. 2. 16. 00:46
728x90
06. DELETE API
어노테이션
- @RestController
- @RequestMapping
- @ DeleteMapping
- @RequestParam
- @PathVariable
- Object
코드
- DeleteApiController.java
package com.example.delete.controller;
import org.springframework.web.bind.annotation.*;
@RestController
@RequestMapping("/api")
public class DeleteApiController {
@DeleteMapping("/delete/{userId}")
public void delete(@PathVariable String userId, @RequestParam String account) {
System.out.println(userId);
System.out.println(account);
// delete -> 리소스 삭제 200 OK
}
}
- API 결과
- Console 결과