SlideShare ist ein Scribd-Unternehmen logo
1 von 39
1
 Anton Bogdan 
◦ Architect in Softengi company 
◦ Enviance team 
 29 years old 
2
Representational 
State 
Transfer 
3 
is a software 
architectural style
2000 by Roy Fielding in his doctoral 
dissertation at UC Irvine 
4
 Client–server 
 Stateless 
 Cacheable 
 Layered system 
5
 Uniform interface 
◦ Identification of resources (URI) 
◦ Manipulation of resources through these 
representations 
◦ Self-descriptive messages 
◦ Hypermedia as the engine of application 
state (A.K.A. HATEOAS) 
6
Then you will get: 
Performance, scalability, simplicity, 
modifiability, visibility, portability, and 
reliability. 
7
8
9
 POST /appointmentService.asmx 
◦ <openSlotRequest date = "2010-01-04" doctor = 
"mjones"/> 
 HTTP/1.1 200 OK 
◦ <openSlotList> 
◦ <slot start = "1400" end = "1450“ status=“open”> 
◦ <doctor id = "mjones"/> 
◦ </slot> 
◦ <slot start = "1600" end = "1650“ status=“booked”> 
◦ <doctor id = "mjones"/> 
◦ </slot> 
◦ </openSlotList> 
10
 POST /doctors/mjones/appointments/ 
◦ <openSlotRequest date = "2010-01-04“/> 
 HTTP/1.1 200 OK 
◦ <openSlotList> 
◦ <slot start = "1400" end = "1450“ status=“open”/> 
◦ <slot start = "1600" end = "1650“ status=“booked”/> 
◦ </openSlotList> 
11
 GET /doctors/mjones/appointments/?date=20100104 
 HTTP/1.1 200 OK 
◦ <openSlotList> 
◦ <slot start = "1400" end = "1450“ status=“open”/> 
◦ <slot start = "1600" end = "1650“ status=“booked”/> 
◦ </openSlotList> 
12
 GET /doctors/mjones/appointments/?date=20100104 
 HTTP/1.1 200 OK 
<openSlotList> 
<slot start = "1400" end = "1450“ status=“open”> 
<link rel=“slots/book” uri=“1400”/> 
<slot/> 
<slot start = "1600" end = "1650“ status=“booked”> 
<link rel=“slots/move” uri=“1600”/> 
<link rel=“slots/cancel” uri=“1600”/> 
<slot/> 
</openSlotList> 
13
 It’s very hard to be fully REST-style 
compatible. 
 Most of modern REST API implementations 
(Flickr api, Twitter api, Google calendar api) 
are just Level 1 and Level 2. 
 Specs based on REST: 
◦ WebDav protocol 
◦ Odata protocol (designed for Entity Framework) 
14
15
◦ /workflows/ 
◦ /workflows/<workflow Id>/ - bad 
◦ /workflows/<workflow Id>-<workflow Name>/ - good 
◦ /workflows/<workflow Name>/ - okay 
16
 Permanent. Should not be changed with time. 
 No special chars or file extensions (.php, 
.aspx) if they are not meaningful. 
 Context friendly. 
◦ /users/current/details 
 vs. /users/user-anton/details 
◦ /forecasts/cambridge/today 
 may redirects to, say, /forecasts/cambridge/2009-04-26 
17
 URI should be human readable and easily guessed. 
 Each part should be meaningful. All URI parts together should be 
good nested, and help visualize the site structure. 
◦ /cars/alfa-romeos/gt 
 Nouns, not verbs. 
 Resource Names: prefer to use lower-case and hyphen instead of 
spaces. 
◦ /tasks/by-a-new-car 
 Resource IDs: prefer to use additional meaning prefix. 
◦ /tasks/task-17 
◦ /conversations/conversation-{id}/todo-list-{id}/todo-{id} 
18
 /workflows/ 
◦ GET – Get a list (?) 
◦ POST - Create 
 201 (Created), Location:<new url> 
 /workflows/SomeItem 
◦ GET - Read 
◦ PUT - Update 
◦ DELETE - Delete 
◦ PATCH – Partial update 
19
You should introduce your own WEB-Methods. 
Examples: 
 /workflows/SomeItem 
 <OPERATION> - Non-standard operations 
 BOOK 
 BUY 
 CALCULATE 
 LOCK 
 RENT 
 … .etc 
from WebDav: 
 /workflows/SomeItem 
 MOVE 
 Destination: <new url> 
 COPY 
 Destination: <new url> 
20
 /workflows/SomeItem/<operation> 
 POST - Non-standard operations 
21
 Less Db identifiers 
 More names and URLs 
 Human readable 
 No .Net/Java specifics: 
◦ type: “MyNamespace.Workflow” 
 URL for hierarchies 
 WebDav - for file systems. 
◦ 
22
 No complex inner structures : 
◦ “name”: “Object name” 
◦ “userfields”: [ 
 { 
 Id:17, 
 name: “Permissions” 
 type: “list of checkboxes” 
 Value: [ 
 {“id”:24, “value” “Open allowed” } 
 {“id”:28, “value” “Close allowed” } 
 ] 
 } 
◦ ] 
 Keep all simple and human readable: 
◦ “name”: “Object name” 
◦ “Permissions”: [“Open allowed”, “Close allowed”] (! manual serialization may be required) 
23
24
 Option #1: URL 
/workflows/?name=My&date=2007 
25
 Option #2: Advanced URI 
/workflows/ 
?date=[MORE]2007 (?date=<2007) 
?name=[LIKE]Jo 
?name=[LIST]Jo,Mary,Anton, 
?type.name=Lab1 
?[order]=name,date 
?[fields]=id,name 
26
 Odata 
◦ service.svc/Posts?$filter=OwnerUserId eq 209 
◦ service.svc/Users?$filter=substringof('SQL',Title) or substringof('sql-server', 
Tags)&$format=json 
 Mongo 
◦ db/collections/?filter_type=cluster&filter_id=1&limit=-10 
 Gdata 
◦ /feeds?fields=link,entry(@gd:etag,id,updated,link[@rel='edit'])) 
 restSQL 
◦ /restsql/res/Actor?first_name=JULIANNE&last_name=DENCH&_limit=10&_offset=0 
27
 Option #3: SQL 
◦ Separate functionality 
◦ Require of supporting public schema & security! 
◦/sql?q=SELECT * FROM 
workflows WHERE name=My 
AND type=system AND date < 
2007&page=1&pagesize=20 
28
/sql?q=SELECT … 
SELECT * 
FROM workflows 
WHERE name=My AND type=system AND date < 2007 
Parsing 
Validating 
Transforming 
Paging 
SELECT TOP 20 w.id, w.name, w.type, cfv.[Field1] 
FROM workflows w 
INNER JOIN permissions p 
ON p.id = p.objectId AND p.userId= <userId> 
INNER JOIN customfieldvalue cfv 
ON p.id = cfv.objectId AND cfv.name = “Field1” 
WHERE name=My AND type=system AND date < 2007 
29
 Send user-password with each request (like 
Basic authentication) 
◦ REST-way style 
◦ Not always practical 
 Session ID in header (implemented) 
◦ Authorization: RESTAPI realm=“<Session ID>” 
 Auth. Cookie (implemented) 
 Auth. Cookie of main Web UI (implemented) 
30
 By URL 
◦ api/ver1/* 
 By header 
◦ X-Rest-Api-Version: 1 
 By mime-type 
◦ Accept: application/vnd.restapiv1+json; 
◦ Accept: application/vnd.restapi+json; version=1; 
31
 Error Codes 
◦ 400 – Bad request (wrong json, ValidationException) 
◦ 401 – Unauthorized (no Session ID) 
◦ 404 – Not Found - ObjectDoesNotExistException 
◦ 409 – Conflict - ObjectAlreadyExistException 
◦ 500 – Unexpected, unknown error 
◦ 503 – Service Unavailable 
 SQL timeout 
 Request limit 
 Retry-After: <seconds> 
 Error Meta: 
error:{ 
errorNumber: 500 
message: “” 
stacktrace: “<for dev only>” 
} 
32
33
 SOAP 
 /Auth.asmx 
 /Workflows.asmx 
 /Tasks.asmx 
 REST 
 /sessions/ 
 /processes/workflows/ 
 /processes/tasks/ 
34
 Well defined standard 
 Complex format 
 Meta Describer: WSDL 
 Not intended to be human readable 
 Excellent support in most IDEs (stub 
generation) 
 Hard to call from JavaScript 
 Each service – separate and independent item 
◦ Auth.asmx 
◦ Workflow.asmx 
35
 Not standardized - is a style 
 Conforms to REST style 
 Lead to design human readable API: 
◦ URL, names, serialized types 
 Bad support in most IDEs (problems with subs 
generation) 
 Easy to call from JavaScript 
 Popular 
 Each service are not separate – solid api: 
◦ /sessions/ 
◦ /processes/workflows/ 
◦ /processes/tasks/ 
36
 REST – it’s not spec, it’s architectural style 
◦ It’s an art! 
 Leverage HTTP! 
 URL, Headers, Mime, Accepts 
 Human readable URLs, XML and JSON ! 
37
38
 http://xpinjection.com/2012/06/14/rest-in-uadevclub-july-5/ 
 http://video.yandex.ua/users/xpinjection/view/192/ 
 http://video.yandex.ua/users/xpinjection/view/193/ 
 http://video.yandex.ua/users/xpinjection/view/194/ 
 http://martinfowler.com/articles/richardsonMaturityModel.html 
 http://www.iana.org/time-zones 
 http://www.w3.org/TR/cors/ 
 https://developers.google.com/gdata/docs/2.0/reference#Partia 
lResponse 
 http://www.mongodb.org/display/DOCS/Advanced+Queries 
 http://restsql.org/doc/ref/index.html 
 http://www.hanselman.com/blog/CreatingAnODataAPIForStackO 
verflowIncludingXMLAndJSONIn30Minutes.aspx 
 Libs: 
◦ http://easyxdm.net/wp/ 
◦ https://github.com/bigeasy/timezone 
39

Weitere ähnliche Inhalte

Was ist angesagt?

Stratalux Cloud Formation and Chef Integration Presentation
Stratalux Cloud Formation and Chef Integration PresentationStratalux Cloud Formation and Chef Integration Presentation
Stratalux Cloud Formation and Chef Integration Presentation
Jeremy Przygode
 
Make your gui shine with ajax solr
Make your gui shine with ajax solrMake your gui shine with ajax solr
Make your gui shine with ajax solr
lucenerevolution
 

Was ist angesagt? (20)

Node.js Express Framework
Node.js Express FrameworkNode.js Express Framework
Node.js Express Framework
 
Express js
Express jsExpress js
Express js
 
Managing JavaScript Dependencies With RequireJS
Managing JavaScript Dependencies With RequireJSManaging JavaScript Dependencies With RequireJS
Managing JavaScript Dependencies With RequireJS
 
Intro to Node
Intro to NodeIntro to Node
Intro to Node
 
Uniface Lectures Webinar - Building Responsive Applications with Uniface: Dev...
Uniface Lectures Webinar - Building Responsive Applications with Uniface: Dev...Uniface Lectures Webinar - Building Responsive Applications with Uniface: Dev...
Uniface Lectures Webinar - Building Responsive Applications with Uniface: Dev...
 
Expressjs
ExpressjsExpressjs
Expressjs
 
Uniface Lectures Webinar - Application & Infrastructure Security - Hardening ...
Uniface Lectures Webinar - Application & Infrastructure Security - Hardening ...Uniface Lectures Webinar - Application & Infrastructure Security - Hardening ...
Uniface Lectures Webinar - Application & Infrastructure Security - Hardening ...
 
[Coscup 2012] JavascriptMVC
[Coscup 2012] JavascriptMVC[Coscup 2012] JavascriptMVC
[Coscup 2012] JavascriptMVC
 
Spring Framework - Web Flow
Spring Framework - Web FlowSpring Framework - Web Flow
Spring Framework - Web Flow
 
Staying Sane with Drupal NEPHP
Staying Sane with Drupal NEPHPStaying Sane with Drupal NEPHP
Staying Sane with Drupal NEPHP
 
the 5 layers of web accessibility - Open Web Camp II
the 5 layers of web accessibility - Open Web Camp IIthe 5 layers of web accessibility - Open Web Camp II
the 5 layers of web accessibility - Open Web Camp II
 
Asynchronous Interfaces
Asynchronous InterfacesAsynchronous Interfaces
Asynchronous Interfaces
 
Jsp/Servlet
Jsp/ServletJsp/Servlet
Jsp/Servlet
 
Stratalux Cloud Formation and Chef Integration Presentation
Stratalux Cloud Formation and Chef Integration PresentationStratalux Cloud Formation and Chef Integration Presentation
Stratalux Cloud Formation and Chef Integration Presentation
 
Make your gui shine with ajax solr
Make your gui shine with ajax solrMake your gui shine with ajax solr
Make your gui shine with ajax solr
 
Introduction to Node.js Platform
Introduction to Node.js PlatformIntroduction to Node.js Platform
Introduction to Node.js Platform
 
Box connector Mule ESB Integration
Box connector Mule ESB IntegrationBox connector Mule ESB Integration
Box connector Mule ESB Integration
 
Spout - Building a RESTful web app with Angular.js and BEAR.Sunday
Spout - Building a RESTful web app with Angular.js and BEAR.SundaySpout - Building a RESTful web app with Angular.js and BEAR.Sunday
Spout - Building a RESTful web app with Angular.js and BEAR.Sunday
 
Introduction to AngularJS For WordPress Developers
Introduction to AngularJS For WordPress DevelopersIntroduction to AngularJS For WordPress Developers
Introduction to AngularJS For WordPress Developers
 
Zk doc1
Zk doc1Zk doc1
Zk doc1
 

Andere mochten auch

power point name of days
power point name of dayspower point name of days
power point name of days
evinasalim
 
AutoTest Refactoring. Архитектурные семинары Softengi
AutoTest Refactoring. Архитектурные семинары SoftengiAutoTest Refactoring. Архитектурные семинары Softengi
AutoTest Refactoring. Архитектурные семинары Softengi
Softengi
 
Mf def fç estr din 28.08.14
Mf def fç estr din   28.08.14Mf def fç estr din   28.08.14
Mf def fç estr din 28.08.14
Inaiara Bragante
 
Curriculo baseado em competencias(1)
Curriculo baseado em competencias(1)Curriculo baseado em competencias(1)
Curriculo baseado em competencias(1)
Inaiara Bragante
 
Разработка Web-приложений на Angular JS. Архитектурные семинары Softengi
Разработка Web-приложений на Angular JS. Архитектурные семинары SoftengiРазработка Web-приложений на Angular JS. Архитектурные семинары Softengi
Разработка Web-приложений на Angular JS. Архитектурные семинары Softengi
Softengi
 

Andere mochten auch (15)

Архитектурные семинары Softengi - инфографика
Архитектурные семинары Softengi - инфографикаАрхитектурные семинары Softengi - инфографика
Архитектурные семинары Softengi - инфографика
 
Softengi's 9 Ways To Fail Your IT Project In The Outsourcing Journal Special ...
Softengi's 9 Ways To Fail Your IT Project In The Outsourcing Journal Special ...Softengi's 9 Ways To Fail Your IT Project In The Outsourcing Journal Special ...
Softengi's 9 Ways To Fail Your IT Project In The Outsourcing Journal Special ...
 
Nola defragmentatu disko gogorra
Nola defragmentatu disko gogorraNola defragmentatu disko gogorra
Nola defragmentatu disko gogorra
 
power point name of days
power point name of dayspower point name of days
power point name of days
 
AutoTest Refactoring. Архитектурные семинары Softengi
AutoTest Refactoring. Архитектурные семинары SoftengiAutoTest Refactoring. Архитектурные семинары Softengi
AutoTest Refactoring. Архитектурные семинары Softengi
 
Crises ciclo de_vida (1)
Crises ciclo de_vida (1)Crises ciclo de_vida (1)
Crises ciclo de_vida (1)
 
Broti Portfolio
Broti PortfolioBroti Portfolio
Broti Portfolio
 
Localize your business - Software Localization Services LocServ
Localize your business - Software Localization Services LocServLocalize your business - Software Localization Services LocServ
Localize your business - Software Localization Services LocServ
 
Mf def fç estr din 28.08.14
Mf def fç estr din   28.08.14Mf def fç estr din   28.08.14
Mf def fç estr din 28.08.14
 
Icd 11 phc draft
Icd 11 phc draftIcd 11 phc draft
Icd 11 phc draft
 
Aula screening abril2014
Aula screening abril2014Aula screening abril2014
Aula screening abril2014
 
Cap 10 duncan
Cap 10 duncanCap 10 duncan
Cap 10 duncan
 
Carteiradeserviços
CarteiradeserviçosCarteiradeserviços
Carteiradeserviços
 
Curriculo baseado em competencias(1)
Curriculo baseado em competencias(1)Curriculo baseado em competencias(1)
Curriculo baseado em competencias(1)
 
Разработка Web-приложений на Angular JS. Архитектурные семинары Softengi
Разработка Web-приложений на Angular JS. Архитектурные семинары SoftengiРазработка Web-приложений на Angular JS. Архитектурные семинары Softengi
Разработка Web-приложений на Angular JS. Архитектурные семинары Softengi
 

Ähnlich wie About REST. Архитектурные семинары Softengi

Developing RESTful WebServices using Jersey
Developing RESTful WebServices using JerseyDeveloping RESTful WebServices using Jersey
Developing RESTful WebServices using Jersey
b_kathir
 
Rest with Java EE 6 , Security , Backbone.js
Rest with Java EE 6 , Security , Backbone.jsRest with Java EE 6 , Security , Backbone.js
Rest with Java EE 6 , Security , Backbone.js
Carol McDonald
 
Java Web services
Java Web servicesJava Web services
Java Web services
vpulec
 
An Introduction to Tornado
An Introduction to TornadoAn Introduction to Tornado
An Introduction to Tornado
Gavin Roy
 

Ähnlich wie About REST. Архитектурные семинары Softengi (20)

Our practice of designing and implementing REST-service API for existing system
Our practice of designing and implementing REST-service API for existing systemOur practice of designing and implementing REST-service API for existing system
Our practice of designing and implementing REST-service API for existing system
 
RESTful web service with JBoss Fuse
RESTful web service with JBoss FuseRESTful web service with JBoss Fuse
RESTful web service with JBoss Fuse
 
ASP.NET WEB API
ASP.NET WEB APIASP.NET WEB API
ASP.NET WEB API
 
Developing RESTful WebServices using Jersey
Developing RESTful WebServices using JerseyDeveloping RESTful WebServices using Jersey
Developing RESTful WebServices using Jersey
 
SQL for Web APIs - Simplifying Data Access for API Consumers
SQL for Web APIs - Simplifying Data Access for API ConsumersSQL for Web APIs - Simplifying Data Access for API Consumers
SQL for Web APIs - Simplifying Data Access for API Consumers
 
Rest with Java EE 6 , Security , Backbone.js
Rest with Java EE 6 , Security , Backbone.jsRest with Java EE 6 , Security , Backbone.js
Rest with Java EE 6 , Security , Backbone.js
 
Rest
RestRest
Rest
 
Building production websites with Node.js on the Microsoft stack
Building production websites with Node.js on the Microsoft stackBuilding production websites with Node.js on the Microsoft stack
Building production websites with Node.js on the Microsoft stack
 
distributing over the web
distributing over the webdistributing over the web
distributing over the web
 
Java Web services
Java Web servicesJava Web services
Java Web services
 
Workshop 4: NodeJS. Express Framework & MongoDB.
Workshop 4: NodeJS. Express Framework & MongoDB.Workshop 4: NodeJS. Express Framework & MongoDB.
Workshop 4: NodeJS. Express Framework & MongoDB.
 
6 tips for improving ruby performance
6 tips for improving ruby performance6 tips for improving ruby performance
6 tips for improving ruby performance
 
OData: Universal Data Solvent or Clunky Enterprise Goo? (GlueCon 2015)
OData: Universal Data Solvent or Clunky Enterprise Goo? (GlueCon 2015)OData: Universal Data Solvent or Clunky Enterprise Goo? (GlueCon 2015)
OData: Universal Data Solvent or Clunky Enterprise Goo? (GlueCon 2015)
 
An Introduction to Tornado
An Introduction to TornadoAn Introduction to Tornado
An Introduction to Tornado
 
Rails Security
Rails SecurityRails Security
Rails Security
 
Service Discovery using etcd, Consul and Kubernetes
Service Discovery using etcd, Consul and KubernetesService Discovery using etcd, Consul and Kubernetes
Service Discovery using etcd, Consul and Kubernetes
 
UEMB200: Next Generation of Endpoint Management Architecture and Discovery Se...
UEMB200: Next Generation of Endpoint Management Architecture and Discovery Se...UEMB200: Next Generation of Endpoint Management Architecture and Discovery Se...
UEMB200: Next Generation of Endpoint Management Architecture and Discovery Se...
 
Boost Development With Java EE7 On EAP7 (Demitris Andreadis)
Boost Development With Java EE7 On EAP7 (Demitris Andreadis)Boost Development With Java EE7 On EAP7 (Demitris Andreadis)
Boost Development With Java EE7 On EAP7 (Demitris Andreadis)
 
Android networking-2
Android networking-2Android networking-2
Android networking-2
 
DSLing your System For Scalability Testing Using Gatling - Dublin Scala User ...
DSLing your System For Scalability Testing Using Gatling - Dublin Scala User ...DSLing your System For Scalability Testing Using Gatling - Dublin Scala User ...
DSLing your System For Scalability Testing Using Gatling - Dublin Scala User ...
 

Mehr von Softengi

Corporate Social Responsibility at Softengi
Corporate Social Responsibility at SoftengiCorporate Social Responsibility at Softengi
Corporate Social Responsibility at Softengi
Softengi
 
Планирование трудозатрат на тестирование
Планирование трудозатрат на тестированиеПланирование трудозатрат на тестирование
Планирование трудозатрат на тестирование
Softengi
 

Mehr von Softengi (18)

Extended Reality Solutions for Digital Marketing
Extended Reality Solutions for Digital MarketingExtended Reality Solutions for Digital Marketing
Extended Reality Solutions for Digital Marketing
 
Intecracy Group Presentation
Intecracy Group PresentationIntecracy Group Presentation
Intecracy Group Presentation
 
Softengi - Inspired Software Engineering
Softengi - Inspired Software EngineeringSoftengi - Inspired Software Engineering
Softengi - Inspired Software Engineering
 
Infographic of Softengi's 2014
Infographic of Softengi's 2014Infographic of Softengi's 2014
Infographic of Softengi's 2014
 
Основы OLAP. Вебинар Workaround в Softengi
Основы OLAP. Вебинар Workaround в SoftengiОсновы OLAP. Вебинар Workaround в Softengi
Основы OLAP. Вебинар Workaround в Softengi
 
Как оценить Тестировщика. Александра Ковалева, Testing Consultant в Softengi
Как оценить Тестировщика. Александра Ковалева, Testing Consultant в SoftengiКак оценить Тестировщика. Александра Ковалева, Testing Consultant в Softengi
Как оценить Тестировщика. Александра Ковалева, Testing Consultant в Softengi
 
Как оценить время на тестирование. Александр Зиновьев, Test Lead Softengi
Как оценить время на тестирование. Александр Зиновьев, Test Lead SoftengiКак оценить время на тестирование. Александр Зиновьев, Test Lead Softengi
Как оценить время на тестирование. Александр Зиновьев, Test Lead Softengi
 
Автоматизированный подход к локализации корпоративных приложений
Автоматизированный подход к локализации корпоративных приложенийАвтоматизированный подход к локализации корпоративных приложений
Автоматизированный подход к локализации корпоративных приложений
 
Scrum и пустота. Доклад Анатолия Кота, менеджера проектов Softengi, на Междун...
Scrum и пустота. Доклад Анатолия Кота, менеджера проектов Softengi, на Междун...Scrum и пустота. Доклад Анатолия Кота, менеджера проектов Softengi, на Междун...
Scrum и пустота. Доклад Анатолия Кота, менеджера проектов Softengi, на Междун...
 
Enviance Environmental ERP
Enviance Environmental ERPEnviance Environmental ERP
Enviance Environmental ERP
 
Corporate Social Responsibility at Softengi
Corporate Social Responsibility at SoftengiCorporate Social Responsibility at Softengi
Corporate Social Responsibility at Softengi
 
Тестирование web-приложений на iPad
Тестирование web-приложений на iPadТестирование web-приложений на iPad
Тестирование web-приложений на iPad
 
Постановка и улучшение Scrum процесса для группы проектов в компании
Постановка и улучшение Scrum процесса для группы проектов в компанииПостановка и улучшение Scrum процесса для группы проектов в компании
Постановка и улучшение Scrum процесса для группы проектов в компании
 
Softengi Software Development Company Profile
Softengi Software Development Company ProfileSoftengi Software Development Company Profile
Softengi Software Development Company Profile
 
Путь к трассировке требований: от идеи к инструменту. SQA-Days 15
Путь к трассировке требований: от идеи к инструменту. SQA-Days 15Путь к трассировке требований: от идеи к инструменту. SQA-Days 15
Путь к трассировке требований: от идеи к инструменту. SQA-Days 15
 
Планирование трудозатрат на тестирование
Планирование трудозатрат на тестированиеПланирование трудозатрат на тестирование
Планирование трудозатрат на тестирование
 
Softengi - Business Process Automation based on Microsoft SharePoint Platform
Softengi - Business Process Automation based on Microsoft SharePoint PlatformSoftengi - Business Process Automation based on Microsoft SharePoint Platform
Softengi - Business Process Automation based on Microsoft SharePoint Platform
 
4 Reasons to Outsource IT to Ukraine
4 Reasons to Outsource IT to Ukraine4 Reasons to Outsource IT to Ukraine
4 Reasons to Outsource IT to Ukraine
 

Kürzlich hochgeladen

1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
QucHHunhnh
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
ZurliaSoop
 

Kürzlich hochgeladen (20)

ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.ppt
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdf
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibit
 
PROCESS RECORDING FORMAT.docx
PROCESS      RECORDING        FORMAT.docxPROCESS      RECORDING        FORMAT.docx
PROCESS RECORDING FORMAT.docx
 
SOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning PresentationSOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning Presentation
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
 
Third Battle of Panipat detailed notes.pptx
Third Battle of Panipat detailed notes.pptxThird Battle of Panipat detailed notes.pptx
Third Battle of Panipat detailed notes.pptx
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
 
Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan Fellows
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...
 
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
 

About REST. Архитектурные семинары Softengi

  • 1. 1
  • 2.  Anton Bogdan ◦ Architect in Softengi company ◦ Enviance team  29 years old 2
  • 3. Representational State Transfer 3 is a software architectural style
  • 4. 2000 by Roy Fielding in his doctoral dissertation at UC Irvine 4
  • 5.  Client–server  Stateless  Cacheable  Layered system 5
  • 6.  Uniform interface ◦ Identification of resources (URI) ◦ Manipulation of resources through these representations ◦ Self-descriptive messages ◦ Hypermedia as the engine of application state (A.K.A. HATEOAS) 6
  • 7. Then you will get: Performance, scalability, simplicity, modifiability, visibility, portability, and reliability. 7
  • 8. 8
  • 9. 9
  • 10.  POST /appointmentService.asmx ◦ <openSlotRequest date = "2010-01-04" doctor = "mjones"/>  HTTP/1.1 200 OK ◦ <openSlotList> ◦ <slot start = "1400" end = "1450“ status=“open”> ◦ <doctor id = "mjones"/> ◦ </slot> ◦ <slot start = "1600" end = "1650“ status=“booked”> ◦ <doctor id = "mjones"/> ◦ </slot> ◦ </openSlotList> 10
  • 11.  POST /doctors/mjones/appointments/ ◦ <openSlotRequest date = "2010-01-04“/>  HTTP/1.1 200 OK ◦ <openSlotList> ◦ <slot start = "1400" end = "1450“ status=“open”/> ◦ <slot start = "1600" end = "1650“ status=“booked”/> ◦ </openSlotList> 11
  • 12.  GET /doctors/mjones/appointments/?date=20100104  HTTP/1.1 200 OK ◦ <openSlotList> ◦ <slot start = "1400" end = "1450“ status=“open”/> ◦ <slot start = "1600" end = "1650“ status=“booked”/> ◦ </openSlotList> 12
  • 13.  GET /doctors/mjones/appointments/?date=20100104  HTTP/1.1 200 OK <openSlotList> <slot start = "1400" end = "1450“ status=“open”> <link rel=“slots/book” uri=“1400”/> <slot/> <slot start = "1600" end = "1650“ status=“booked”> <link rel=“slots/move” uri=“1600”/> <link rel=“slots/cancel” uri=“1600”/> <slot/> </openSlotList> 13
  • 14.  It’s very hard to be fully REST-style compatible.  Most of modern REST API implementations (Flickr api, Twitter api, Google calendar api) are just Level 1 and Level 2.  Specs based on REST: ◦ WebDav protocol ◦ Odata protocol (designed for Entity Framework) 14
  • 15. 15
  • 16. ◦ /workflows/ ◦ /workflows/<workflow Id>/ - bad ◦ /workflows/<workflow Id>-<workflow Name>/ - good ◦ /workflows/<workflow Name>/ - okay 16
  • 17.  Permanent. Should not be changed with time.  No special chars or file extensions (.php, .aspx) if they are not meaningful.  Context friendly. ◦ /users/current/details  vs. /users/user-anton/details ◦ /forecasts/cambridge/today  may redirects to, say, /forecasts/cambridge/2009-04-26 17
  • 18.  URI should be human readable and easily guessed.  Each part should be meaningful. All URI parts together should be good nested, and help visualize the site structure. ◦ /cars/alfa-romeos/gt  Nouns, not verbs.  Resource Names: prefer to use lower-case and hyphen instead of spaces. ◦ /tasks/by-a-new-car  Resource IDs: prefer to use additional meaning prefix. ◦ /tasks/task-17 ◦ /conversations/conversation-{id}/todo-list-{id}/todo-{id} 18
  • 19.  /workflows/ ◦ GET – Get a list (?) ◦ POST - Create  201 (Created), Location:<new url>  /workflows/SomeItem ◦ GET - Read ◦ PUT - Update ◦ DELETE - Delete ◦ PATCH – Partial update 19
  • 20. You should introduce your own WEB-Methods. Examples:  /workflows/SomeItem  <OPERATION> - Non-standard operations  BOOK  BUY  CALCULATE  LOCK  RENT  … .etc from WebDav:  /workflows/SomeItem  MOVE  Destination: <new url>  COPY  Destination: <new url> 20
  • 21.  /workflows/SomeItem/<operation>  POST - Non-standard operations 21
  • 22.  Less Db identifiers  More names and URLs  Human readable  No .Net/Java specifics: ◦ type: “MyNamespace.Workflow”  URL for hierarchies  WebDav - for file systems. ◦ 22
  • 23.  No complex inner structures : ◦ “name”: “Object name” ◦ “userfields”: [  {  Id:17,  name: “Permissions”  type: “list of checkboxes”  Value: [  {“id”:24, “value” “Open allowed” }  {“id”:28, “value” “Close allowed” }  ]  } ◦ ]  Keep all simple and human readable: ◦ “name”: “Object name” ◦ “Permissions”: [“Open allowed”, “Close allowed”] (! manual serialization may be required) 23
  • 24. 24
  • 25.  Option #1: URL /workflows/?name=My&date=2007 25
  • 26.  Option #2: Advanced URI /workflows/ ?date=[MORE]2007 (?date=<2007) ?name=[LIKE]Jo ?name=[LIST]Jo,Mary,Anton, ?type.name=Lab1 ?[order]=name,date ?[fields]=id,name 26
  • 27.  Odata ◦ service.svc/Posts?$filter=OwnerUserId eq 209 ◦ service.svc/Users?$filter=substringof('SQL',Title) or substringof('sql-server', Tags)&$format=json  Mongo ◦ db/collections/?filter_type=cluster&filter_id=1&limit=-10  Gdata ◦ /feeds?fields=link,entry(@gd:etag,id,updated,link[@rel='edit']))  restSQL ◦ /restsql/res/Actor?first_name=JULIANNE&last_name=DENCH&_limit=10&_offset=0 27
  • 28.  Option #3: SQL ◦ Separate functionality ◦ Require of supporting public schema & security! ◦/sql?q=SELECT * FROM workflows WHERE name=My AND type=system AND date < 2007&page=1&pagesize=20 28
  • 29. /sql?q=SELECT … SELECT * FROM workflows WHERE name=My AND type=system AND date < 2007 Parsing Validating Transforming Paging SELECT TOP 20 w.id, w.name, w.type, cfv.[Field1] FROM workflows w INNER JOIN permissions p ON p.id = p.objectId AND p.userId= <userId> INNER JOIN customfieldvalue cfv ON p.id = cfv.objectId AND cfv.name = “Field1” WHERE name=My AND type=system AND date < 2007 29
  • 30.  Send user-password with each request (like Basic authentication) ◦ REST-way style ◦ Not always practical  Session ID in header (implemented) ◦ Authorization: RESTAPI realm=“<Session ID>”  Auth. Cookie (implemented)  Auth. Cookie of main Web UI (implemented) 30
  • 31.  By URL ◦ api/ver1/*  By header ◦ X-Rest-Api-Version: 1  By mime-type ◦ Accept: application/vnd.restapiv1+json; ◦ Accept: application/vnd.restapi+json; version=1; 31
  • 32.  Error Codes ◦ 400 – Bad request (wrong json, ValidationException) ◦ 401 – Unauthorized (no Session ID) ◦ 404 – Not Found - ObjectDoesNotExistException ◦ 409 – Conflict - ObjectAlreadyExistException ◦ 500 – Unexpected, unknown error ◦ 503 – Service Unavailable  SQL timeout  Request limit  Retry-After: <seconds>  Error Meta: error:{ errorNumber: 500 message: “” stacktrace: “<for dev only>” } 32
  • 33. 33
  • 34.  SOAP  /Auth.asmx  /Workflows.asmx  /Tasks.asmx  REST  /sessions/  /processes/workflows/  /processes/tasks/ 34
  • 35.  Well defined standard  Complex format  Meta Describer: WSDL  Not intended to be human readable  Excellent support in most IDEs (stub generation)  Hard to call from JavaScript  Each service – separate and independent item ◦ Auth.asmx ◦ Workflow.asmx 35
  • 36.  Not standardized - is a style  Conforms to REST style  Lead to design human readable API: ◦ URL, names, serialized types  Bad support in most IDEs (problems with subs generation)  Easy to call from JavaScript  Popular  Each service are not separate – solid api: ◦ /sessions/ ◦ /processes/workflows/ ◦ /processes/tasks/ 36
  • 37.  REST – it’s not spec, it’s architectural style ◦ It’s an art!  Leverage HTTP!  URL, Headers, Mime, Accepts  Human readable URLs, XML and JSON ! 37
  • 38. 38
  • 39.  http://xpinjection.com/2012/06/14/rest-in-uadevclub-july-5/  http://video.yandex.ua/users/xpinjection/view/192/  http://video.yandex.ua/users/xpinjection/view/193/  http://video.yandex.ua/users/xpinjection/view/194/  http://martinfowler.com/articles/richardsonMaturityModel.html  http://www.iana.org/time-zones  http://www.w3.org/TR/cors/  https://developers.google.com/gdata/docs/2.0/reference#Partia lResponse  http://www.mongodb.org/display/DOCS/Advanced+Queries  http://restsql.org/doc/ref/index.html  http://www.hanselman.com/blog/CreatingAnODataAPIForStackO verflowIncludingXMLAndJSONIn30Minutes.aspx  Libs: ◦ http://easyxdm.net/wp/ ◦ https://github.com/bigeasy/timezone 39

Hinweis der Redaktion

  1. Кто не слышал про REST? Кто не только слышал но и знает что такое рест?
  2. Может для кого-то это будет сюрпризом - REST это не вебсерсисы, это не спецификация - это архитектурный стиль распределенных систем.
  3. Понятие REST ввел Рой Филдинг в своей докторской диссертации. Он является одним из авторов HTTP и URI. Он выделил определенный стиль или подход распределенной системы WWW, и назвал его REST.
  4. Если распределенная система хочет хочет следовать REST стилю - то она должна выполяться следующие требования.
  5. Взамен выполнения таких требований - общая стоимость системы понизиться. Также, у такой системы легко достичь следующих важных качеств: Быстродействие, маштабирование, расширяемость, доступность, отказоустойчивость, гипкость.
  6. Сейчас давайте перейдем к практическому примеру применения REST - в Web Services. До этого мы говорили что WWW уже следует rest стилю. Web Sevices обычно базируються на WWW, так в чем же отличие? Отличие заключаеться в том что распределенная система может использовать элементы WWW (HTTP) как, к примеру, транспорт и при этом НЕ следовать REST. Так делают SOAP WebServices. Потому, для выявления уровня соответсвия системы REST стилю - существует так называемая "Модель Зрелости Ричардсона".
  7. Вот она на илюстрации. Зачастую её используют для определения соответствия Web-Services REST стилю. Тоесть далее мы будем илюстрировать примеры на уровне HTTP протокола.
  8. На нулевом уровне - мы используем HTTP как транспорт. Так обычно поступает SOAP, также он может использовать и другой транспорт - smpt, даже UPD тд. На примере не показано но даже в самом XML сообщении есть и место для хедеров, HTTP хедеры не используються.
  9. Здесь мы вводим адресацию, использую URL.
  10. Здесь мы начинаем использовать HTTP Methods - например, GET - для Readonly и POST для остальных. Это уже дает возможно кеширования на уровне сервера, прокси-сервера или клиента.
  11. Здесь мы добавляем hyper-text. В данном случае - для избавления клиента от необходимости строить URL, перемещая логику на сервер.
  12. Большинство существующих вебсервисов имеет 1 или 2 уровень. Хорошими примерами успешного примения REST стиля в Webservices можно считать спецификации WebDav. и к примеру ODATA. О них по -позже.