Download presentation
Presentation is loading. Please wait.
1
RESTful Web Service 2014 년 12 월 한연희 yhhan@koreatech.ac.kr http://link.koreatech.ac.kr
2
REST – Definition and Motivation REST (Representational State Transfer) – 웹을 기반으로 하는 대규모 네트워크 시스템 설계 및 구현을 위한 일종의 원칙들의 모음 –2000 년 Roy Fielding 의 박사 학위 논문에서 처음 제안. 제목 : Architectural Styles and the Design of Network-based Software Architectures http://www.ics.uci.edu/~fielding/pubs/dissertation/top.htm 최근 REST 에 대한 인식 변화 – 기존 방식인 SOAP, XML-RPC 등을 대치하는 웹 서비스 (Web Service) 구현 방식 2
3
Why is it called “Representational State Transfer?” 3 “Web” is a REST system! State n State n+1 google GET http://www.google.com State n+1 GET https://www.google.co.kr/search?q=IoT Representation html/xml/json Representation html/xml/json facebook State n+2 GET https://www.facebook.com/nest Representation html/xml/json a link selection
4
REST is Not a Standard! REST is not a standard –You will not see the W3C REST specification. REST is just a design pattern –You can design your Web services according to its rules. REST uses standards: –HTTP –URL –XML/HTML/JSON/RSS/GIF/JPEG/etc. (Resource Representations) –text/xml, text/html, image/gif, image/jpeg, etc. (Resource Types, MIME Types) 4
5
REST’s Key Abstraction: Resources Any information that can be named can be a resource –Document, Image, Service ( e.g. Today's weather in NY) and so on… Identified by URI –http://weather.com/nyhttp://weather.com/ny Represented by a standard format –html –xml –json –rss –… 5 Resource http://weather.com/ny 31.5 NY’s Weather [URI] [HTML]
6
REST Generic Interface CRUD/HTTP – 전체 시스템은 단지 다음 4 개의 명령을 사용해서만 동작 6 GET http://wisefree.com/employee 전체 직원 명단을 얻어 온다.http://wisefree.com/employee POST http://wisefree.com/employee/603045 특정 직원의 자세한 정보를 생성한다. GET http://wisefree.com/employee/603045 특정 직원의 자세한 정보를 얻어온다.http://wisefree.com/employee/603045 PUT http://wisefree.com/employee/603045 특정 직원의 해당 정보를 갱신한다.http://wisefree.com/employee/603045 DELETE http://wisefree.com/employee/603045 특정 직원의 해당 정보를 삭제한다.http://wisefree.com/employee/603045 애플리케이션 작업 HTTP 명령 Create ( 생성 ) POST Read ( 읽기 ) GET Update ( 갱신 ) PUT Delete ( 삭제 ) DELETE [Note] http://wisefree.com/employee?id=603045 – (X)http://wisefree.com/employee?id=603045
7
REST Web Service Design Resources – 제공하려고 하는 자원 ( 리소스, Resource) 은 무엇인가 ? Representation – 지원할 Content-type 은 어떤 것들이 있는가 ? XML, JSON, RSS, … Operation – 지원할 연산은 어떤 것들이 있는가 ? GET/POST/PUT/DELETE Description – 별도의 웹 페이지 (?) –RSDL (RESTful Service Description Language) 7
8
REST vs. RPC (Remote Procedure Call) style REST vs RPC-style (Java RMI, CORBA, DCOM, SOAP…) 8
9
REST Design Example Airline Reservation Service: Approach 1 –“Press 1 for Premier, Press 2 for…“ 9 Premier Members Frequent Flyer Members Regular Members Airline Reservations Answering Machine Premier Customer Representative F.F. Customer Representative Regular Customer Representative
10
REST Design Example Airline Reservation Service: Approach 2 –“Telephone Numbers are Cheap! Use Them!” 10 Premier Customer Representative F.F. Customer Representative Regular Customer Representative Premier Members Frequent Flyer Members 1-800-Premier 1-800-Frequent 1-800-Reservation Regular Members
11
Web Design – Axiom 0 11 Premier Members Frequent Flyer Members Regular Members client http://www.kings-air/reservations/premier http://www.kings-air/reservations/frequent-flyer http://www.kings-air/reservations/regular Premier Member Reservation Service Frequent Flyer Reservation Service Regular Member Reservation Service
12
REST Design - Advantages 12 The different URLs are discoverable by search engines. Easy to understand what each service does –simply by examining the URL. No need to introduce rules. –Just CRUD is all of rules –"What you see is what you get.“ Consistent with Axiom 0.
13
RESTful Open API Example 13 Twitter –Retrieving “Follower Information” using HTTP GET https://api.twitter.com/1.1/followers/ids.json?cursor=- 1&screen_name=sitestreams&count=5000 {11221722, 23428412, …}
14
RESTful Open API Example 14 Facebook (https://developers.facebook.com/tools/explorer)
15
RESTful Open API Example 15 NAVER –Retrieving “ 벤허 영화 정보 ” using HTTP GET http://openapi.naver.com/search?key=test&query= 벤허 &display=10&start=1&target=movie
16
Government 2.0 & Open API 16 서울 열린 데이터 광장 (http://data.seoul.go.kr/)http://data.seoul.go.kr/
17
Government 2.0 & Open API 17 서울 열린 데이터 광장 (http://data.seoul.go.kr/)http://data.seoul.go.kr/
18
Government 2.0 & Open API 18 일반 시민들이 직접 공공데이터를 활용해 만든 앱들
19
Open API Statistics 19 Source (2012): Blog - Innotribe (http://petervan.files.wordpress.com/2012/07/apibillionaires.png)http://petervan.files.wordpress.com/2012/07/apibillionaires.png
20
20 Resources ( Things) URLs Generic Operations
21
21 인식의 발전
22
Basic GET Request and IoT 22
23
Advanced GET Request and IoT 23 Subscribe & Notify (Push)
24
웹 ( 인터넷 )+IoT 기술 발전방향 24 “ 웹은 기술적이라기 보다는 사회적인 창조에 가깝다. 나는 기술적인 장난감이 아니라 사람들이 함께 일함에 도움을 주는 것 같은 사회적인 효과를 위해 웹을 디자인했다. 웹의 궁극적인 목적은 우리의 거미줄 같은 생활을 지원하고 향상시키는 데 있다.” – Tim Berners-Lee
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.