본문 바로가기

Spring43

delete방식-- 삭제할 때 사용//talend Api// DELETE API - 웹 애플리케이션 서버를 거쳐 데이터베이스 등의 저장소에 리소스를 삭제할 때 사용 package com.study.springboot; import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; .. 2023. 7. 31.
put방식 -- 수정할 때 사용//talend Api//@RequestBody PUT API -웹 애플리케이션 서브를 통해 데이터베이스 같은 저장소에 존재하는 리소스값을 업데이트 하는데 사용(POST와 거의 동일) ResponseEntity는 Spring Framework에서 HTTP 응답을 나타내는 클래스인 ResponseEntity를 사용하고, 제네릭 타입으로 MemberDto를 지정한 것입니다. ResponseEntity.status(HttpStatus.ACCEPTED)는 상태 코드가 202 ACCEPTED인 HTTP 응답을 생성하는 메서드 .body(member)는 응답 본문에 member 객체를 포함시키는 메서드입니다. 즉, 클라이언트는 요청에 대한 응답으로 JSON 형식의 member 객체를 받을 수 있습니다 package com.study.springboot; impo.. 2023. 7. 31.
post방식--등록할 때 사용//talend Api//@RequestBody() POST API 웹 애플리케이션을 통해 데이터베이스 등의 저장소에 리소스를 저장할 때 사용하는 API -JSON형태를 써야할 경우 @RequestBody 어노테이션을 사용하면 클라이언트가 보낸 데이터를 간편하게 자바 객체로 변환할 수 있으므로, JSON, XML 등의 데이터를 처리하는 웹 서비스를 개발할 때 유용하게 사용됩니다. post는 url에 적는게 아니라 body에 적어야한다 RequestBody안적으면 null이 뜬다 package com.study.springboot; import java.util.Map; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotatio.. 2023. 7. 31.
get방식--요청 시 사용 // talend Api 구글확장프로그램//@RestController//@GetMapping()//@RequestMapping("/api/v1/get-api")//@PathVariable// 구글확장프로그램 추가 GET API 웹 애플리케이션 서버에서 값을 가져올 때 사용하는 API(파라미터 용도: 자료를 지정) @RestController: ResponseBody생략 가능 - > view를 제공x -> 데이터만 내보낼 경우 (ex)- 공공데이터) @RequestMapping("/api/v1/get-api"): 해당 컨트롤러의 모든 핸들러 메서드가 "/api/v1/get-api" 경로를 처리하도록 지정 value (또는 path): 요청을 처리할 URL 경로를 지정 method=RequestMethod.GET으로 설정되어 있으므로, getHello() 메서드는 GET 요청에 응답하도록 지정 @PathVariable 아래처럼해도된다 package com.study.springboot; impo.. 2023. 7. 31.