[Spring Boot] DELETE API

이맑음·2021년 9월 16일
0

Spring Boot

목록 보기
6/21
post-thumbnail

DELETE API

  • CRUD 중 DELETE
  • 멱등성을 가지지만 안정성을 갖진 않았다.
  • Path Variable, Query Parameter, DataBody(사용할 수 있지만 권장하지 않는다)

예제

  • 삭제할 리소스가 없는데 삭제를 요청해도 멱등성을 가지기 때문에 200 ok가 나온다.
@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);

    }

}
  • Talend Api Test
  • Response
  • 서버

0개의 댓글