일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 |
- http
- Servlet
- 스프링 핵심 기능
- Greedy
- 알고리즘
- 인프런
- 김영한
- 스프링 핵심 원리
- pointcut
- SpringBoot
- Android
- jpa
- AOP
- Proxy
- QueryDSL
- java
- Exception
- kotlin
- Thymeleaf
- JPQL
- transaction
- 자바
- springdatajpa
- 스프링
- 그리디
- 백준
- spring
- Spring Boot
- JDBC
- db
- Today
- Total
목록API (7)
개발자되기 프로젝트
현재는 출발, 도착지의 위도/경도를 직접 입력한다. 지역 이름을 검색하면, 위도/경도를 반환하는 api를 활용하자. 1. Google Geocoding Google Cloud Platform에서 key를 발급받고, Geocoding API를 활용해 보자. 호출 예시를 보자. The following example requests the latitude and longitude of "1600 Amphitheatre Parkway, Mountain View, CA", and specifies that the output must be in JSON format. https://maps.googleapis.com/maps/api/geocode/json?address=1600+Amphitheatre+Parkw..
HTML 페이지의 경우 지금까지 설명했던 것 처럼 4xx, 5xx와 같은 오류 페이지만 있으면 대부분의 문제를 해결할 수 있음. API는 각 오류 상황에 맞는 오류 응답 스펙을 정하고, JSON으로 데이터를 내려줘야함. 1. WevServerCustomizer WAS에 예외가 전달되거나, response.sendError() 가 호출되면 위에 등록한 예외 페이지 경로가 호출됨. import org.springframework.boot.web.server.ConfigurableWebServerFactory; import org.springframework.boot.web.server.ErrorPage; import org.springframework.boot.web.server.WebServerFactor..
@Valid , @Validated 는 HttpMessageConverter ( @RequestBody )에도 적용할 수 있음. 1. @ModelAttribute, @RequestBody @ModelAttribute : HTTP 요청 파라미터(URL 쿼리 스트링, POST Form)를 다룰 때 사용 @RequestBody : HTTP Body의 데이터를 객체로 변환할 때 사용한다. 주로 API JSON 요청을 다룰 때 사용 2. Controller @RestController = @Controller + @ReponseBody @RequestBody : JSON 데이터를 객체로 바꿔줌. @Slf4j @RestController @RequestMapping("/validation/api/items") pu..
1. 회원 관리 API 회원 목록 조회: GET /users 회원 등록: POST /users 회원 조회: GET /users/{userId} 회원 수정: PATCH /users/{userId} 회원 삭제: DELETE /users/{userId} 2. Controller @RestController public class MappingClassController { @GetMapping("/mapping/users/") public String user(){ return "get users"; } @PostMapping("/mapping/users") public String addUser(){ return "post user"; } @GetMapping("/mapping/users/{userId}")..
* @RestController = @Controller + @ReponseBody * @RequestBody : JSON 데이터를 Member로 바꿔줌. 1.회원 등록 : 엔티티를 @RequestBody에 직접 매핑 api에서 엔티티를 직접 사용하면 여러 문제점이 있다 엔티티에 프레젠테이션 계층을 위한 로직이 추가됨 엔티티에 API검증을 위한 로직이 들어감.(@NotEmpty 등) 엔티티가 변경되면 API스펙이 변한다. ㅜㅜ @PostMapping("/api/v1/members") public CreateMemberResponse saveMemberV1(@RequestBody @Valid Member member){ Long id = memberService.join(member); return new..
앞선 글에서 Naver API사용 시 에러코드 SE99(HTTP상태코드 500)가 뜨면서, 내부 서버 에러가 발생했다. 진짜로 서버 에러인줄 알고 있었는데, 네이버에서 제공하는 오류 코드를 보고 내가 잘못했구나.. 라는 의심이 생김. HTTP 상태 코드(오류 유형) 오류 발생 원인 해결 방법 500(서버 오류) 필수 요청 변수가 없거나 요청 변수 이름이 잘못된 경우 API 레퍼런스에서 필수 요청 변수를 확인합니다. 500(서버 오류) 요청 변수의 값을 URL 인코딩으로 변환하지 않고 전송한 경우 API 레퍼런스에서 해당 요청 변수를 URL 인코딩으로 변환해야 하는지 확인합니다. 500(서버 오류) API 호출은 정상적으로 했지만, API 서버 유지 보수나 시스템 오류로 인한 오류가 발생한 경우 개발자 포..
1. 오늘의 목표 API controller를 통해 DB에 movie 객체 CRUD 2. Movie, Movie Repository 생성 필드명은 NAVER API의 reponse내용을 참고했다. @Data @NoArgsConstructor @AllArgsConstructor @Entity public class Movie { @Id @GeneratedValue private int id; private String title; private String link; private String image; private String subtitle; private LocalDate pubDate; private String director; private String actor; private String..