SlideShare une entreprise Scribd logo
1  sur  53
Télécharger pour lire hors ligne
Copyright © 2019, Oracle and/or its affiliates. All rights reserved. | Confidential – Oracle Internal/Restricted/Highly Restricted
10th Oracle
Developer
MeetupREST API Design Principles
되새기기
이동희(DongHee Lee)
Principal Solution Engineer
Oracle Korea Solution Engineering
Copyright © 2019, Oracle and/or its affiliates. All rights reserved. |
Safe Harbor Statement
The following is intended to outline our general product direction. It is intended for
information purposes only, and may not be incorporated into any contract. It is not a
commitment to deliver any material, code, or functionality, and should not be relied upon
in making purchasing decisions. The development, release, timing, and pricing of any
features or functionality described for Oracle’s products may change and remains at the
sole discretion of Oracle Corporation.
Confidential – Oracle Internal/Restricted/Highly Restricted 2
Copyright © 2019, Oracle and/or its affiliates. All rights reserved. | Confidential – Oracle Internal/Restricted/Highly Restricted 3
Microservice 배포
지난 3월 16일….
1
코드 개발
후 코드 Push
2
Wercker
빌드 후 Image 생성
3
Image를
Registry에 Push
4
Kubernetes에
배포
5
Image를 가져와서
Kubernetes 내 Container 기동
개발자
OCI
Registry
OCI
Container Engine
for Kubernetes
(OKE)
Wercker 서비스를 이용한 Workflow 자동화
Copyright © 2019, Oracle and/or its affiliates. All rights reserved. | Confidential – Oracle Internal/Restricted/Highly Restricted 4
오늘은…
1
코드 개발
후 코드 Push
개발자
Copyright © 2019, Oracle and/or its affiliates. All rights reserved. | Confidential – Oracle Internal/Restricted/Highly Restricted 5
오늘은…
코드 개발
후 코드 Push
개발자
요건 분석 디자인 & 프로토타입 개발
Backend
REST API 설계
Front-End
Back-End
Copyright © 2019, Oracle and/or its affiliates. All rights reserved. | Confidential – Oracle Internal/Restricted/Highly Restricted 6
SOAP
vs.
REST
Copyright © 2019, Oracle and/or its affiliates. All rights reserved. | Confidential – Oracle Internal/Restricted/Highly Restricted 7
Simple Object Access Protocol
vs.
REpresentational State Transfer
Copyright © 2019, Oracle and/or its affiliates. All rights reserved. | Confidential – Oracle Internal/Restricted/Highly Restricted 8
SOAP: Protocol
vs.
REST: Architectural Style
Copyright © 2019, Oracle and/or its affiliates. All rights reserved. |
What is REST?
• 2000년, Roy Fielding의 박사 논문에서 제시된 분산 Hypermedia 시스템을 위한 아키텍처 스타일
• Guiding Principles of REST
– Client–Server
– Stateless
– Cacheable
– Uniform interface
• identification of resources
• manipulation of resources through representations
• self-descriptive messages
• hypermedia as the engine of application state
– Layered system
– Code on demand (optional)
Confidential – Oracle Internal/Restricted/Highly Restricted 9
Copyright © 2019, Oracle and/or its affiliates. All rights reserved. | Confidential – Oracle Internal/Restricted/Highly Restricted 10
– Uniform Interface
• Identification of Resources
• Manipulation of Resources through Representations
• Self-Descriptive Messages
• Hypermedia As The Engine Of Application State
Copyright © 2019, Oracle and/or its affiliates. All rights reserved. | Confidential – Oracle Internal/Restricted/Highly Restricted 11
Resource
Copyright © 2019, Oracle and/or its affiliates. All rights reserved. | Confidential – Oracle Internal/Restricted/Highly Restricted 12
#1. Use nouns to represent resources
: Resource를 명사로 표현하라.
Copyright © 2019, Oracle and/or its affiliates. All rights reserved. | Confidential – Oracle Internal/Restricted/Highly Restricted 13
첫 번째는 집합(Collection)
Copyright © 2019, Oracle and/or its affiliates. All rights reserved. | Confidential – Oracle Internal/Restricted/Highly Restricted 14
/users
Copyright © 2019, Oracle and/or its affiliates. All rights reserved. | Confidential – Oracle Internal/Restricted/Highly Restricted 15
두 번째는 단일 개체
Copyright © 2019, Oracle and/or its affiliates. All rights reserved. | Confidential – Oracle Internal/Restricted/Highly Restricted 16
/users/{userId}
Copyright © 2019, Oracle and/or its affiliates. All rights reserved. | Confidential – Oracle Internal/Restricted/Highly Restricted 17
#2. HTTP Operation를 사용하라
Copyright © 2019, Oracle and/or its affiliates. All rights reserved. | Confidential – Oracle Internal/Restricted/Highly Restricted 18
CREATE
READ
UPDATE
DELETE
Copyright © 2019, Oracle and/or its affiliates. All rights reserved. | Confidential – Oracle Internal/Restricted/Highly Restricted 19
POST
GET
PUT
DELETE
Copyright © 2019, Oracle and/or its affiliates. All rights reserved. | Confidential – Oracle Internal/Restricted/Highly Restricted 20
Resource POST
(create)
GET
(read)
PUT
(update)
DELETE
(delete)
/users
Create
new user
List users
Bulk Update
users
Delete
all users
/users/kildong - Get kildong Update kildong Delete kildong
Copyright © 2019, Oracle and/or its affiliates. All rights reserved. | Confidential – Oracle Internal/Restricted/Highly Restricted 21
OCI IAM Service API > User 예시
Resource POST
(create)
GET
(read)
PUT
(update)
DELETE
(delete)
/users CreateUser ListUsers - -
/users/kildong - GetUser UpdateUser DeleteUser
Copyright © 2019, Oracle and/or its affiliates. All rights reserved. | Confidential – Oracle Internal/Restricted/Highly Restricted 22
추가로 필요한 조건들은 어떻게?
Copyright © 2019, Oracle and/or its affiliates. All rights reserved. | Confidential – Oracle Internal/Restricted/Highly Restricted 23
#3. 추가로 조건들은
Query Parameter를 사용하라
Copyright © 2019, Oracle and/or its affiliates. All rights reserved. | Confidential – Oracle Internal/Restricted/Highly Restricted 24
/users?title=Mr&status=active
Copyright © 2019, Oracle and/or its affiliates. All rights reserved. | Confidential – Oracle Internal/Restricted/Highly Restricted 25
/users?q={status=`active`}
Copyright © 2019, Oracle and/or its affiliates. All rights reserved. | Confidential – Oracle Internal/Restricted/Highly Restricted 26
#4. Error 메시지
Copyright © 2019, Oracle and/or its affiliates. All rights reserved. | Confidential – Oracle Internal/Restricted/Highly Restricted 27
Oracle OCI
HTTP Status Code: 401
{
"code": "NotAuthenticated",
"message": "The required information to complete authentication was not provided or was incorrect."
}
FaceBook
HTTP Status Code: 200
{
"error": {
"message": "Message describing the error",
"type": "OAuthException",
"code": 190,
"error_subcode": 460,
"error_user_title": "A title",
"error_user_msg": "A message",
"fbtrace_id": "EJplcsCHuLu“
}
}
HTTP Status Code는 항상 200, 오류 코드와 하위 오류코드 사용
Twitter
HTTP Status Code: 404
{
"errors": [ {
"message":"Sorry, that page does not exist",
"code":34
}]
}
HTTP Status Code중 15개 사용, 오류 코드 사용
코드 이름 조치
190 액세스 토큰이 만료됨 새 액세스 토큰을 가져옵니다.
코드 이름 설명
34 Sorry, that page does not exist
Corresponds with HTTP 404. The
specified resource was not found.
HTTP Status Code Error Code Description
401 NotAuthenticated
The required authentication information was
not provided or was incorrect…
Copyright © 2019, Oracle and/or its affiliates. All rights reserved. |
2가지 Code 사용
• HTTP Status Codes - 클라이언트 코드를 위해 사용
– 1xx (Informational): The request was received, continuing process
– 2xx (Successful): The request was successfully received, understood, and accepted
– 3xx (Redirection): Further action needs to be taken in order to complete the request
– 4xx (Client Error): The request contains bad syntax or cannot be fulfilled
– 5xx (Server Error): The server failed to fulfill an apparently valid request
• Custom Error Codes – 사람을 위한 메시지
Confidential – Oracle Internal/Restricted/Highly Restricted 28
예시) OCI REST API
{
"code": "NotAuthenticated" or "34"
"message": "The required information to complete authentication was not provided or was incorrect."
}
Copyright © 2019, Oracle and/or its affiliates. All rights reserved. | Confidential – Oracle Internal/Restricted/Highly Restricted 29
#5. API 버전 관리
Copyright © 2019, Oracle and/or its affiliates. All rights reserved. |
Version
• Facebook
– /v3.2/{user-id}/post
• Twitter
– /5/accounts
• Oracle PaaS: IDCS API
– /admin/v1/Users/{id}
• Oracle Cloud Infrastructure API
– /20160918/users/
Confidential – Oracle Internal/Restricted/Highly Restricted 30
Copyright © 2019, Oracle and/or its affiliates. All rights reserved. | Confidential – Oracle Internal/Restricted/Highly Restricted 31
그 밖에 사항
Copyright © 2019, Oracle and/or its affiliates. All rights reserved. | Confidential – Oracle Internal/Restricted/Highly Restricted 32
#6. 응답 메시지는 항상 모든 것을 줄까?
Copyright © 2019, Oracle and/or its affiliates. All rights reserved. |
조회 칼럼 지정
• Facebook
– /{your-user-id}/photos
– /{your-user-id}/photos?fields=height,width
Confidential – Oracle Internal/Restricted/Highly Restricted 33
{
"data": [
{
"created_time": "2016-08-23T13:12:10+0000",
"id": "1308573619175349" // Photo ID
}
]
}
{
"data": [
{
"height": 720,
"width": 720,
"id": "1308573619175349" // Photo ID
}
]
}
Copyright © 2019, Oracle and/or its affiliates. All rights reserved. | Confidential – Oracle Internal/Restricted/Highly Restricted 34
#7. Page 처리는?
Copyright © 2019, Oracle and/or its affiliates. All rights reserved. |
List Pagination
• FaceBook
– offset
– limit
• Twitter
– page
– rpp (return per page)
Confidential – Oracle Internal/Restricted/Highly Restricted 35
Copyright © 2019, Oracle and/or its affiliates. All rights reserved. |
List Pagination
• FaceBook
– offset
– limit
• Twitter
– count
– cursor
• LinkedIn
– start
– count
Confidential – Oracle Internal/Restricted/Highly Restricted 36
Copyright © 2019, Oracle and/or its affiliates. All rights reserved. |
List Pagination
• FaceBook
– offset
– limit
• Twitter
– count
– cursor
• LinkedIn
– start
– count
Confidential – Oracle Internal/Restricted/Highly Restricted 37
• Oracle PaaS API
– offset
– limit
• Oracle Cloud Infrastructure API
– page
– limit
Copyright © 2019, Oracle and/or its affiliates. All rights reserved. |
Time-based Pagination
• FaceBook
– since
– until
– /me/posts?since=1364849754&until=1364587774
Confidential – Oracle Internal/Restricted/Highly Restricted 38
조회 결과의 개수가 최대 얼마나 클지를
실행 전까지는 알 수 없습니다.
질문. 직접 개발한다면, 결과를 어떤 방식으로 줄까요?
Copyright © 2019, Oracle and/or its affiliates. All rights reserved. | Confidential – Oracle Internal/Restricted/Highly Restricted 39
HATEOAS
(Hypermedia
As The Engine Of Application State)
Copyright © 2019, Oracle and/or its affiliates. All rights reserved. |
Hypermedia As The Engine Of Application State
• FaceBook
– /me/posts?offset=0&limit=2
Confidential – Oracle Internal/Restricted/Highly Restricted 40
{
"data": [
{
"message": "",
"created_time": "2012-03-20T06:04:36+0000",
"id": ""
},
{
"message": "",
"created_time": "2012-01-19T11:26:04+0000",
"id": "2700528826685328_256082517796650"
}
],
"paging": {
"previous": "https://graph.facebook.com/v3.2/2700528826685328/posts?limit=2&~~~&__previous=1",
"next": "https://graph.facebook.com/v3.2/2700528826685328/posts?limit=2&~~~~"
}
}
Copyright © 2019, Oracle and/or its affiliates. All rights reserved. |
Hypermedia As The Engine Of Application State
• FaceBook
– /me/posts?since=1298937600&until=1546300800&limit=2
Confidential – Oracle Internal/Restricted/Highly Restricted 41
{
"data": [
{
"message": "",
"created_time": "2012-03-20T06:04:36+0000",
"id": "2700528826685328_295284543876447"
},
{
"message": "",
"created_time": "2012-01-19T11:26:04+0000",
"id": "2700528826685328_256082517796650"
}
],
"paging": {
"previous": "https://graph.facebook.com/v3.2/2700528826685328/posts?limit=2&since=1332223476
&format=json&access_token=~~~~&__paging_token=~~~~&__previous=1",
"next": "https://graph.facebook.com/v3.2/2700528826685328/posts?limit=2&since=1298937600
&format=json&access_token=~~~~&until=1326972364&__paging_token=~~~~"
}
}
Copyright © 2019, Oracle and/or its affiliates. All rights reserved. | Confidential – Oracle Internal/Restricted/Highly Restricted 42
Store
Or Association?
Copyright © 2019, Oracle and/or its affiliates. All rights reserved. | Confidential – Oracle Internal/Restricted/Highly Restricted 43
/users/{userId}/state
Copyright © 2019, Oracle and/or its affiliates. All rights reserved. | Confidential – Oracle Internal/Restricted/Highly Restricted 44
Non Resource
Copyright © 2019, Oracle and/or its affiliates. All rights reserved. | Confidential – Oracle Internal/Restricted/Highly Restricted 45
HelloWorld
Translate
Exchange
Copyright © 2019, Oracle and/or its affiliates. All rights reserved. | Confidential – Oracle Internal/Restricted/Highly Restricted 46
Use verb
: 동사로 표현하라.
Copyright © 2019, Oracle and/or its affiliates. All rights reserved. | Confidential – Oracle Internal/Restricted/Highly Restricted 47
/translate?from=korean&to=english
Copyright © 2019, Oracle and/or its affiliates. All rights reserved. |
• KakaoPay API
Confidential – Oracle Internal/Restricted/Highly Restricted 48
Copyright © 2019, Oracle and/or its affiliates. All rights reserved. |
• KakaoPay API
Confidential – Oracle Internal/Restricted/Highly Restricted 49
Copyright © 2019, Oracle and/or its affiliates. All rights reserved. | Confidential – Oracle Internal/Restricted/Highly Restricted 50
REST API Design Principles
Copyright © 2019, Oracle and/or its affiliates. All rights reserved. |
REST API Design Principles
• #1. Resource를 명사로 표현하라
– 첫 번째는 집합(Collection), 두 번째는 단일개체
• #2. HTTP Operation를 사용하라
• #3. 추가로 조건들은 Query Parameter를 사용하라
• #4. Error 메시지는 HTTP Response Codes & Custom Error Codes
• #5. API 버전 관리 – /v1/users or /20160918/users
Confidential – Oracle Internal/Restricted/Highly Restricted 51
Copyright © 2019, Oracle and/or its affiliates. All rights reserved. | Confidential – Oracle Internal/Restricted/Highly Restricted 52
10thMeetup-20190420-REST API Design Principles 되새기기

Contenu connexe

Tendances

Tendances (20)

Introduction to Kubernetes
Introduction to KubernetesIntroduction to Kubernetes
Introduction to Kubernetes
 
Kubernetes automation in production
Kubernetes automation in productionKubernetes automation in production
Kubernetes automation in production
 
Microservices, Kubernetes and Istio - A Great Fit!
Microservices, Kubernetes and Istio - A Great Fit!Microservices, Kubernetes and Istio - A Great Fit!
Microservices, Kubernetes and Istio - A Great Fit!
 
Orchestrating Microservices with Kubernetes
Orchestrating Microservices with Kubernetes Orchestrating Microservices with Kubernetes
Orchestrating Microservices with Kubernetes
 
Kubernetes Networking 101
Kubernetes Networking 101Kubernetes Networking 101
Kubernetes Networking 101
 
Enabling ceph-mgr to control Ceph services via Kubernetes
Enabling ceph-mgr to control Ceph services via KubernetesEnabling ceph-mgr to control Ceph services via Kubernetes
Enabling ceph-mgr to control Ceph services via Kubernetes
 
MongoDB.local Austin 2018: MongoDB Ops Manager + Kubernetes
MongoDB.local Austin 2018: MongoDB Ops Manager + KubernetesMongoDB.local Austin 2018: MongoDB Ops Manager + Kubernetes
MongoDB.local Austin 2018: MongoDB Ops Manager + Kubernetes
 
From pets to cattle - powered by CoreOS, docker, Mesos & nginx
From pets to cattle - powered by CoreOS, docker, Mesos & nginxFrom pets to cattle - powered by CoreOS, docker, Mesos & nginx
From pets to cattle - powered by CoreOS, docker, Mesos & nginx
 
Lifecycle of a pod
Lifecycle of a podLifecycle of a pod
Lifecycle of a pod
 
Kubernetes extensibility
Kubernetes extensibilityKubernetes extensibility
Kubernetes extensibility
 
Ansible, integration testing, and you.
Ansible, integration testing, and you.Ansible, integration testing, and you.
Ansible, integration testing, and you.
 
Load Balancing in the Cloud using Nginx & Kubernetes
Load Balancing in the Cloud using Nginx & KubernetesLoad Balancing in the Cloud using Nginx & Kubernetes
Load Balancing in the Cloud using Nginx & Kubernetes
 
Demystifying the Nuts & Bolts of Kubernetes Architecture
Demystifying the Nuts & Bolts of Kubernetes ArchitectureDemystifying the Nuts & Bolts of Kubernetes Architecture
Demystifying the Nuts & Bolts of Kubernetes Architecture
 
JDO 2019: What you should be aware of before setting up kubernetes on premise...
JDO 2019: What you should be aware of before setting up kubernetes on premise...JDO 2019: What you should be aware of before setting up kubernetes on premise...
JDO 2019: What you should be aware of before setting up kubernetes on premise...
 
[Devconf.cz][2017] Understanding OpenShift Security Context Constraints
[Devconf.cz][2017] Understanding OpenShift Security Context Constraints[Devconf.cz][2017] Understanding OpenShift Security Context Constraints
[Devconf.cz][2017] Understanding OpenShift Security Context Constraints
 
Kubernetes Monitoring & Best Practices
Kubernetes Monitoring & Best PracticesKubernetes Monitoring & Best Practices
Kubernetes Monitoring & Best Practices
 
Kubernetes persistence 101
Kubernetes persistence 101Kubernetes persistence 101
Kubernetes persistence 101
 
OpenStack Architecture
OpenStack ArchitectureOpenStack Architecture
OpenStack Architecture
 
Modular Layer 2 In OpenStack Neutron
Modular Layer 2 In OpenStack NeutronModular Layer 2 In OpenStack Neutron
Modular Layer 2 In OpenStack Neutron
 
fabric8 ... and Docker, Kubernetes & OpenShift
fabric8 ... and Docker, Kubernetes & OpenShiftfabric8 ... and Docker, Kubernetes & OpenShift
fabric8 ... and Docker, Kubernetes & OpenShift
 

Similaire à 10thMeetup-20190420-REST API Design Principles 되새기기

Extending Enterprise Applications to mobile interfaces-Final
Extending Enterprise Applications to mobile interfaces-FinalExtending Enterprise Applications to mobile interfaces-Final
Extending Enterprise Applications to mobile interfaces-Final
Rohit Dhamija
 

Similaire à 10thMeetup-20190420-REST API Design Principles 되새기기 (20)

API Design Principles Essential 
API Design Principles Essential API Design Principles Essential 
API Design Principles Essential 
 
Nonblocking Database Access in Helidon SE
Nonblocking Database Access in Helidon SENonblocking Database Access in Helidon SE
Nonblocking Database Access in Helidon SE
 
Extending Enterprise Applications to mobile interfaces-Final
Extending Enterprise Applications to mobile interfaces-FinalExtending Enterprise Applications to mobile interfaces-Final
Extending Enterprise Applications to mobile interfaces-Final
 
Public hyperledger meetup sf may 2018
Public hyperledger meetup sf may 2018Public hyperledger meetup sf may 2018
Public hyperledger meetup sf may 2018
 
Getting Started with API Management – Why It's Needed On-prem and in the Cloud
Getting Started with API Management – Why It's Needed On-prem and in the CloudGetting Started with API Management – Why It's Needed On-prem and in the Cloud
Getting Started with API Management – Why It's Needed On-prem and in the Cloud
 
RESTful Services for your Oracle Autonomous Database
RESTful Services for your Oracle Autonomous DatabaseRESTful Services for your Oracle Autonomous Database
RESTful Services for your Oracle Autonomous Database
 
oracle-apac-developers-meetup-2-building-api-with-apiary-slides
oracle-apac-developers-meetup-2-building-api-with-apiary-slidesoracle-apac-developers-meetup-2-building-api-with-apiary-slides
oracle-apac-developers-meetup-2-building-api-with-apiary-slides
 
Securing your Applications for the Cloud Age
Securing your Applications for the Cloud AgeSecuring your Applications for the Cloud Age
Securing your Applications for the Cloud Age
 
Crafting enhanced customer experience through chatbots, beacons and oracle jet
Crafting enhanced customer experience through chatbots, beacons and oracle jetCrafting enhanced customer experience through chatbots, beacons and oracle jet
Crafting enhanced customer experience through chatbots, beacons and oracle jet
 
Oracle Modern AppDev Approach to Cloud & Container Native App
Oracle Modern AppDev Approach to Cloud & Container Native AppOracle Modern AppDev Approach to Cloud & Container Native App
Oracle Modern AppDev Approach to Cloud & Container Native App
 
API, Integration, and SOA Convergence
API, Integration, and SOA ConvergenceAPI, Integration, and SOA Convergence
API, Integration, and SOA Convergence
 
How to add stuff to MySQL
How to add stuff to MySQLHow to add stuff to MySQL
How to add stuff to MySQL
 
Webex APIs for Admins - Cisco Live Orlando 2018 - DEVNET-3610
Webex APIs for Admins - Cisco Live Orlando 2018 - DEVNET-3610Webex APIs for Admins - Cisco Live Orlando 2018 - DEVNET-3610
Webex APIs for Admins - Cisco Live Orlando 2018 - DEVNET-3610
 
REST API Doc Best Practices
REST API Doc Best PracticesREST API Doc Best Practices
REST API Doc Best Practices
 
Oracle database 12c_and_DevOps
Oracle database 12c_and_DevOpsOracle database 12c_and_DevOps
Oracle database 12c_and_DevOps
 
Oracle Cloud Café hybrid Cloud 19 mai 2016
Oracle Cloud Café hybrid Cloud 19 mai 2016Oracle Cloud Café hybrid Cloud 19 mai 2016
Oracle Cloud Café hybrid Cloud 19 mai 2016
 
Oracle Management Cloud - HybridCloud Café - May 2016
Oracle Management Cloud - HybridCloud Café - May 2016Oracle Management Cloud - HybridCloud Café - May 2016
Oracle Management Cloud - HybridCloud Café - May 2016
 
API Design – More than just a Payload Definition
API Design – More than just a Payload DefinitionAPI Design – More than just a Payload Definition
API Design – More than just a Payload Definition
 
Api design and prototype
Api design and prototypeApi design and prototype
Api design and prototype
 
Oracle APEX Social Login
Oracle APEX Social LoginOracle APEX Social Login
Oracle APEX Social Login
 

Dernier

TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
mohitmore19
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
Health
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
VictorSzoltysek
 

Dernier (20)

Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionIntroducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docx
 
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS LiveVip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
 
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation Template
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Models
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with Precision
 
10 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 202410 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 2024
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
 
8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students
 

10thMeetup-20190420-REST API Design Principles 되새기기

  • 1. Copyright © 2019, Oracle and/or its affiliates. All rights reserved. | Confidential – Oracle Internal/Restricted/Highly Restricted 10th Oracle Developer MeetupREST API Design Principles 되새기기 이동희(DongHee Lee) Principal Solution Engineer Oracle Korea Solution Engineering
  • 2. Copyright © 2019, Oracle and/or its affiliates. All rights reserved. | Safe Harbor Statement The following is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into any contract. It is not a commitment to deliver any material, code, or functionality, and should not be relied upon in making purchasing decisions. The development, release, timing, and pricing of any features or functionality described for Oracle’s products may change and remains at the sole discretion of Oracle Corporation. Confidential – Oracle Internal/Restricted/Highly Restricted 2
  • 3. Copyright © 2019, Oracle and/or its affiliates. All rights reserved. | Confidential – Oracle Internal/Restricted/Highly Restricted 3 Microservice 배포 지난 3월 16일…. 1 코드 개발 후 코드 Push 2 Wercker 빌드 후 Image 생성 3 Image를 Registry에 Push 4 Kubernetes에 배포 5 Image를 가져와서 Kubernetes 내 Container 기동 개발자 OCI Registry OCI Container Engine for Kubernetes (OKE) Wercker 서비스를 이용한 Workflow 자동화
  • 4. Copyright © 2019, Oracle and/or its affiliates. All rights reserved. | Confidential – Oracle Internal/Restricted/Highly Restricted 4 오늘은… 1 코드 개발 후 코드 Push 개발자
  • 5. Copyright © 2019, Oracle and/or its affiliates. All rights reserved. | Confidential – Oracle Internal/Restricted/Highly Restricted 5 오늘은… 코드 개발 후 코드 Push 개발자 요건 분석 디자인 & 프로토타입 개발 Backend REST API 설계 Front-End Back-End
  • 6. Copyright © 2019, Oracle and/or its affiliates. All rights reserved. | Confidential – Oracle Internal/Restricted/Highly Restricted 6 SOAP vs. REST
  • 7. Copyright © 2019, Oracle and/or its affiliates. All rights reserved. | Confidential – Oracle Internal/Restricted/Highly Restricted 7 Simple Object Access Protocol vs. REpresentational State Transfer
  • 8. Copyright © 2019, Oracle and/or its affiliates. All rights reserved. | Confidential – Oracle Internal/Restricted/Highly Restricted 8 SOAP: Protocol vs. REST: Architectural Style
  • 9. Copyright © 2019, Oracle and/or its affiliates. All rights reserved. | What is REST? • 2000년, Roy Fielding의 박사 논문에서 제시된 분산 Hypermedia 시스템을 위한 아키텍처 스타일 • Guiding Principles of REST – Client–Server – Stateless – Cacheable – Uniform interface • identification of resources • manipulation of resources through representations • self-descriptive messages • hypermedia as the engine of application state – Layered system – Code on demand (optional) Confidential – Oracle Internal/Restricted/Highly Restricted 9
  • 10. Copyright © 2019, Oracle and/or its affiliates. All rights reserved. | Confidential – Oracle Internal/Restricted/Highly Restricted 10 – Uniform Interface • Identification of Resources • Manipulation of Resources through Representations • Self-Descriptive Messages • Hypermedia As The Engine Of Application State
  • 11. Copyright © 2019, Oracle and/or its affiliates. All rights reserved. | Confidential – Oracle Internal/Restricted/Highly Restricted 11 Resource
  • 12. Copyright © 2019, Oracle and/or its affiliates. All rights reserved. | Confidential – Oracle Internal/Restricted/Highly Restricted 12 #1. Use nouns to represent resources : Resource를 명사로 표현하라.
  • 13. Copyright © 2019, Oracle and/or its affiliates. All rights reserved. | Confidential – Oracle Internal/Restricted/Highly Restricted 13 첫 번째는 집합(Collection)
  • 14. Copyright © 2019, Oracle and/or its affiliates. All rights reserved. | Confidential – Oracle Internal/Restricted/Highly Restricted 14 /users
  • 15. Copyright © 2019, Oracle and/or its affiliates. All rights reserved. | Confidential – Oracle Internal/Restricted/Highly Restricted 15 두 번째는 단일 개체
  • 16. Copyright © 2019, Oracle and/or its affiliates. All rights reserved. | Confidential – Oracle Internal/Restricted/Highly Restricted 16 /users/{userId}
  • 17. Copyright © 2019, Oracle and/or its affiliates. All rights reserved. | Confidential – Oracle Internal/Restricted/Highly Restricted 17 #2. HTTP Operation를 사용하라
  • 18. Copyright © 2019, Oracle and/or its affiliates. All rights reserved. | Confidential – Oracle Internal/Restricted/Highly Restricted 18 CREATE READ UPDATE DELETE
  • 19. Copyright © 2019, Oracle and/or its affiliates. All rights reserved. | Confidential – Oracle Internal/Restricted/Highly Restricted 19 POST GET PUT DELETE
  • 20. Copyright © 2019, Oracle and/or its affiliates. All rights reserved. | Confidential – Oracle Internal/Restricted/Highly Restricted 20 Resource POST (create) GET (read) PUT (update) DELETE (delete) /users Create new user List users Bulk Update users Delete all users /users/kildong - Get kildong Update kildong Delete kildong
  • 21. Copyright © 2019, Oracle and/or its affiliates. All rights reserved. | Confidential – Oracle Internal/Restricted/Highly Restricted 21 OCI IAM Service API > User 예시 Resource POST (create) GET (read) PUT (update) DELETE (delete) /users CreateUser ListUsers - - /users/kildong - GetUser UpdateUser DeleteUser
  • 22. Copyright © 2019, Oracle and/or its affiliates. All rights reserved. | Confidential – Oracle Internal/Restricted/Highly Restricted 22 추가로 필요한 조건들은 어떻게?
  • 23. Copyright © 2019, Oracle and/or its affiliates. All rights reserved. | Confidential – Oracle Internal/Restricted/Highly Restricted 23 #3. 추가로 조건들은 Query Parameter를 사용하라
  • 24. Copyright © 2019, Oracle and/or its affiliates. All rights reserved. | Confidential – Oracle Internal/Restricted/Highly Restricted 24 /users?title=Mr&status=active
  • 25. Copyright © 2019, Oracle and/or its affiliates. All rights reserved. | Confidential – Oracle Internal/Restricted/Highly Restricted 25 /users?q={status=`active`}
  • 26. Copyright © 2019, Oracle and/or its affiliates. All rights reserved. | Confidential – Oracle Internal/Restricted/Highly Restricted 26 #4. Error 메시지
  • 27. Copyright © 2019, Oracle and/or its affiliates. All rights reserved. | Confidential – Oracle Internal/Restricted/Highly Restricted 27 Oracle OCI HTTP Status Code: 401 { "code": "NotAuthenticated", "message": "The required information to complete authentication was not provided or was incorrect." } FaceBook HTTP Status Code: 200 { "error": { "message": "Message describing the error", "type": "OAuthException", "code": 190, "error_subcode": 460, "error_user_title": "A title", "error_user_msg": "A message", "fbtrace_id": "EJplcsCHuLu“ } } HTTP Status Code는 항상 200, 오류 코드와 하위 오류코드 사용 Twitter HTTP Status Code: 404 { "errors": [ { "message":"Sorry, that page does not exist", "code":34 }] } HTTP Status Code중 15개 사용, 오류 코드 사용 코드 이름 조치 190 액세스 토큰이 만료됨 새 액세스 토큰을 가져옵니다. 코드 이름 설명 34 Sorry, that page does not exist Corresponds with HTTP 404. The specified resource was not found. HTTP Status Code Error Code Description 401 NotAuthenticated The required authentication information was not provided or was incorrect…
  • 28. Copyright © 2019, Oracle and/or its affiliates. All rights reserved. | 2가지 Code 사용 • HTTP Status Codes - 클라이언트 코드를 위해 사용 – 1xx (Informational): The request was received, continuing process – 2xx (Successful): The request was successfully received, understood, and accepted – 3xx (Redirection): Further action needs to be taken in order to complete the request – 4xx (Client Error): The request contains bad syntax or cannot be fulfilled – 5xx (Server Error): The server failed to fulfill an apparently valid request • Custom Error Codes – 사람을 위한 메시지 Confidential – Oracle Internal/Restricted/Highly Restricted 28 예시) OCI REST API { "code": "NotAuthenticated" or "34" "message": "The required information to complete authentication was not provided or was incorrect." }
  • 29. Copyright © 2019, Oracle and/or its affiliates. All rights reserved. | Confidential – Oracle Internal/Restricted/Highly Restricted 29 #5. API 버전 관리
  • 30. Copyright © 2019, Oracle and/or its affiliates. All rights reserved. | Version • Facebook – /v3.2/{user-id}/post • Twitter – /5/accounts • Oracle PaaS: IDCS API – /admin/v1/Users/{id} • Oracle Cloud Infrastructure API – /20160918/users/ Confidential – Oracle Internal/Restricted/Highly Restricted 30
  • 31. Copyright © 2019, Oracle and/or its affiliates. All rights reserved. | Confidential – Oracle Internal/Restricted/Highly Restricted 31 그 밖에 사항
  • 32. Copyright © 2019, Oracle and/or its affiliates. All rights reserved. | Confidential – Oracle Internal/Restricted/Highly Restricted 32 #6. 응답 메시지는 항상 모든 것을 줄까?
  • 33. Copyright © 2019, Oracle and/or its affiliates. All rights reserved. | 조회 칼럼 지정 • Facebook – /{your-user-id}/photos – /{your-user-id}/photos?fields=height,width Confidential – Oracle Internal/Restricted/Highly Restricted 33 { "data": [ { "created_time": "2016-08-23T13:12:10+0000", "id": "1308573619175349" // Photo ID } ] } { "data": [ { "height": 720, "width": 720, "id": "1308573619175349" // Photo ID } ] }
  • 34. Copyright © 2019, Oracle and/or its affiliates. All rights reserved. | Confidential – Oracle Internal/Restricted/Highly Restricted 34 #7. Page 처리는?
  • 35. Copyright © 2019, Oracle and/or its affiliates. All rights reserved. | List Pagination • FaceBook – offset – limit • Twitter – page – rpp (return per page) Confidential – Oracle Internal/Restricted/Highly Restricted 35
  • 36. Copyright © 2019, Oracle and/or its affiliates. All rights reserved. | List Pagination • FaceBook – offset – limit • Twitter – count – cursor • LinkedIn – start – count Confidential – Oracle Internal/Restricted/Highly Restricted 36
  • 37. Copyright © 2019, Oracle and/or its affiliates. All rights reserved. | List Pagination • FaceBook – offset – limit • Twitter – count – cursor • LinkedIn – start – count Confidential – Oracle Internal/Restricted/Highly Restricted 37 • Oracle PaaS API – offset – limit • Oracle Cloud Infrastructure API – page – limit
  • 38. Copyright © 2019, Oracle and/or its affiliates. All rights reserved. | Time-based Pagination • FaceBook – since – until – /me/posts?since=1364849754&until=1364587774 Confidential – Oracle Internal/Restricted/Highly Restricted 38 조회 결과의 개수가 최대 얼마나 클지를 실행 전까지는 알 수 없습니다. 질문. 직접 개발한다면, 결과를 어떤 방식으로 줄까요?
  • 39. Copyright © 2019, Oracle and/or its affiliates. All rights reserved. | Confidential – Oracle Internal/Restricted/Highly Restricted 39 HATEOAS (Hypermedia As The Engine Of Application State)
  • 40. Copyright © 2019, Oracle and/or its affiliates. All rights reserved. | Hypermedia As The Engine Of Application State • FaceBook – /me/posts?offset=0&limit=2 Confidential – Oracle Internal/Restricted/Highly Restricted 40 { "data": [ { "message": "", "created_time": "2012-03-20T06:04:36+0000", "id": "" }, { "message": "", "created_time": "2012-01-19T11:26:04+0000", "id": "2700528826685328_256082517796650" } ], "paging": { "previous": "https://graph.facebook.com/v3.2/2700528826685328/posts?limit=2&~~~&__previous=1", "next": "https://graph.facebook.com/v3.2/2700528826685328/posts?limit=2&~~~~" } }
  • 41. Copyright © 2019, Oracle and/or its affiliates. All rights reserved. | Hypermedia As The Engine Of Application State • FaceBook – /me/posts?since=1298937600&until=1546300800&limit=2 Confidential – Oracle Internal/Restricted/Highly Restricted 41 { "data": [ { "message": "", "created_time": "2012-03-20T06:04:36+0000", "id": "2700528826685328_295284543876447" }, { "message": "", "created_time": "2012-01-19T11:26:04+0000", "id": "2700528826685328_256082517796650" } ], "paging": { "previous": "https://graph.facebook.com/v3.2/2700528826685328/posts?limit=2&since=1332223476 &format=json&access_token=~~~~&__paging_token=~~~~&__previous=1", "next": "https://graph.facebook.com/v3.2/2700528826685328/posts?limit=2&since=1298937600 &format=json&access_token=~~~~&until=1326972364&__paging_token=~~~~" } }
  • 42. Copyright © 2019, Oracle and/or its affiliates. All rights reserved. | Confidential – Oracle Internal/Restricted/Highly Restricted 42 Store Or Association?
  • 43. Copyright © 2019, Oracle and/or its affiliates. All rights reserved. | Confidential – Oracle Internal/Restricted/Highly Restricted 43 /users/{userId}/state
  • 44. Copyright © 2019, Oracle and/or its affiliates. All rights reserved. | Confidential – Oracle Internal/Restricted/Highly Restricted 44 Non Resource
  • 45. Copyright © 2019, Oracle and/or its affiliates. All rights reserved. | Confidential – Oracle Internal/Restricted/Highly Restricted 45 HelloWorld Translate Exchange
  • 46. Copyright © 2019, Oracle and/or its affiliates. All rights reserved. | Confidential – Oracle Internal/Restricted/Highly Restricted 46 Use verb : 동사로 표현하라.
  • 47. Copyright © 2019, Oracle and/or its affiliates. All rights reserved. | Confidential – Oracle Internal/Restricted/Highly Restricted 47 /translate?from=korean&to=english
  • 48. Copyright © 2019, Oracle and/or its affiliates. All rights reserved. | • KakaoPay API Confidential – Oracle Internal/Restricted/Highly Restricted 48
  • 49. Copyright © 2019, Oracle and/or its affiliates. All rights reserved. | • KakaoPay API Confidential – Oracle Internal/Restricted/Highly Restricted 49
  • 50. Copyright © 2019, Oracle and/or its affiliates. All rights reserved. | Confidential – Oracle Internal/Restricted/Highly Restricted 50 REST API Design Principles
  • 51. Copyright © 2019, Oracle and/or its affiliates. All rights reserved. | REST API Design Principles • #1. Resource를 명사로 표현하라 – 첫 번째는 집합(Collection), 두 번째는 단일개체 • #2. HTTP Operation를 사용하라 • #3. 추가로 조건들은 Query Parameter를 사용하라 • #4. Error 메시지는 HTTP Response Codes & Custom Error Codes • #5. API 버전 관리 – /v1/users or /20160918/users Confidential – Oracle Internal/Restricted/Highly Restricted 51
  • 52. Copyright © 2019, Oracle and/or its affiliates. All rights reserved. | Confidential – Oracle Internal/Restricted/Highly Restricted 52