SlideShare a Scribd company logo
1 of 20
 Anton Bogdan
◦ Architect in Softengi company
 (Kiev, Zhitomir, Kharkov)
 29 years old
 7 years of experience
◦ 5 years of one project
◦ 2 years as an architect
2
 Enterprise application for corporate
clients(100+)
 SaaS, access via browser (ASP.Net).
 Heaviest DB for single client - 70Gb (MS SQL)
 10+ years in production
 1M code-lines
 .Net
◦ ASP.Net, Remoting, WCF, WF
 MSSQL
◦ Service broker, AlwaysOn Failover Cluster
3
4
Custom form
please!
5
Web Services
AJAX
Static files
hosting
Static
Resources
.js
.html .CSS
Server-side
/apps/<app Id>/*
/api/*
 SOAP
 /Auth.asmx
 /Workflows.asmx
 /Tasks.asmx
 REST
 /sessions/
 /processes/workflows/
 /processes/tasks/
6
 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 !
7
 /workflows/<Name>
◦ GET - Read
◦ PUT - Update
◦ DELETE - Delete
 /workflows/
◦ POST - Create
 201 (Created), Location:<new url>
8
 /workflows/<Name>
 MOVE
 Destination: <new url>
 COPY
 Destination: <new url>
 PATCH
 POST /workflows/<Name>/close
9
 GET /workflows/
 -> String[]
 GET /workflows/?created=<2007
 -> String[]
10
/sql?q=SELECT * FROM workflows WHERE
date < 2007
Parsing
Validating
Transforming
Paging
SELECT TOP 20
w.id, w.name, w.type, cfv.[Field1]
FROM workflows w
JOIN permissions p
ON p.objectId = w.id
JOIN customfieldvalue cfv
ON cfv.objectId = w.id AND cfv.name = “Field1”
WHERE date < 2007
AND p.userId= <userId>
11
 Less Db identifiers
 More names and URLs
 No .Net/Java specifics:
◦ type: “MyNamespace.Workflow”
 No complex inner structures
 URL for hierarchies
 WebDav - for file systems.
12
 400 – Bad request (ParseException, ValidationException)
 401 – Unauthorized (wrong Session ID)
 404 – Not Found (ObjectDoesNotExistException)
 409 – Conflict (ObjectAlreadyExistException)
 500 – Unexpected
 503 – Service Unavailable
13
 Authentication
 Session ID in header or cookies
 Response Caching
 Etags
 Throttling
 Versioning
 api/ver1/*
14
 sdk.js (require jquery.js json2.js)
 Javascript API:
◦ sdk.auth.authenticate(userName, password, onsuccess, onerror)
◦ sdk.auth.getInfo(onsuccess, onerror)
◦ sdk.auth.end(onsuccess, onerror)
◦ sdk.workflows.create(name, object, onsuccess, onerror)
◦ sdk.workflows.update(name, object, onsuccess, onerror)
◦ sdk.workflows.delete(name, onsuccess, onerror)
◦ …
15
 No Date type in JSON spec! - ISO Date
 DateTime TZ problems
 CORS (server-side + EasyXDM)
 HttpRequest: PATCH operation
 Files Download/Upload (+ progress)
16
 sdk.js+qunit.js+JsTestDriver+TeamCity
 DB setup-rollback problems
 JS async tests – new for our developers
17
18
asyncTest("Delete workflow - Happy path", 1, function() {
var queue = new ActionQueue(this);
// Given
queue.enqueue(function() {
sdk.workflow.createWorkflow(”Wf1",
function(response) { queue.executeNext();}, errorHandler);
});
// When
queue.enqueue(function() {
sdk.workflow.deleteWorkflow(”Wf1",
function(response) {
// Then
equal(response.metadata.statusCode, 204, "Status code OK");
}, errorHandler);
});
queue.executeNext();
});
19
 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.jopera.org/files/soa-amsterdam-restws-
pautasso-talk.pdf
 http://www.infoq.com/news/2008/05/rest-vs-ws-star
 http://www.iana.org/time-zones
 http://www.w3.org/TR/cors/
 Libs:
◦ http://easyxdm.net/wp/
◦ https://github.com/bigeasy/timezone
20

More Related Content

What's hot

Wakanda - apps.berlin.js - 2012-11-29
Wakanda - apps.berlin.js - 2012-11-29Wakanda - apps.berlin.js - 2012-11-29
Wakanda - apps.berlin.js - 2012-11-29
Alexandre Morgaut
 
CodeFest 2014. Пухальский И. — Отзывчивые кроссплатформенные веб-приложения
CodeFest 2014. Пухальский И. — Отзывчивые кроссплатформенные веб-приложенияCodeFest 2014. Пухальский И. — Отзывчивые кроссплатформенные веб-приложения
CodeFest 2014. Пухальский И. — Отзывчивые кроссплатформенные веб-приложения
CodeFest
 

What's hot (20)

Node.js Express Framework
Node.js Express FrameworkNode.js Express Framework
Node.js Express Framework
 
Lazy load Everything!
Lazy load Everything!Lazy load Everything!
Lazy load Everything!
 
Authenticating and Securing Node.js APIs
Authenticating and Securing Node.js APIsAuthenticating and Securing Node.js APIs
Authenticating and Securing Node.js APIs
 
Managing JavaScript Dependencies With RequireJS
Managing JavaScript Dependencies With RequireJSManaging JavaScript Dependencies With RequireJS
Managing JavaScript Dependencies With RequireJS
 
JavaCro'14 - Securing web applications with Spring Security 3 – Fernando Redo...
JavaCro'14 - Securing web applications with Spring Security 3 – Fernando Redo...JavaCro'14 - Securing web applications with Spring Security 3 – Fernando Redo...
JavaCro'14 - Securing web applications with Spring Security 3 – Fernando Redo...
 
ZK framework
ZK frameworkZK framework
ZK framework
 
Requirejs
RequirejsRequirejs
Requirejs
 
Rails3 asset-pipeline
Rails3 asset-pipelineRails3 asset-pipeline
Rails3 asset-pipeline
 
JBoss Seam vs JSF
JBoss Seam vs JSFJBoss Seam vs JSF
JBoss Seam vs JSF
 
Zk doc1
Zk doc1Zk doc1
Zk doc1
 
Wakanda - apps.berlin.js - 2012-11-29
Wakanda - apps.berlin.js - 2012-11-29Wakanda - apps.berlin.js - 2012-11-29
Wakanda - apps.berlin.js - 2012-11-29
 
Wheel.js
Wheel.jsWheel.js
Wheel.js
 
Intro to Sails.js
Intro to Sails.jsIntro to Sails.js
Intro to Sails.js
 
CQ5 and Sling overview
CQ5 and Sling overviewCQ5 and Sling overview
CQ5 and Sling overview
 
CodeFest 2014. Пухальский И. — Отзывчивые кроссплатформенные веб-приложения
CodeFest 2014. Пухальский И. — Отзывчивые кроссплатформенные веб-приложенияCodeFest 2014. Пухальский И. — Отзывчивые кроссплатформенные веб-приложения
CodeFest 2014. Пухальский И. — Отзывчивые кроссплатформенные веб-приложения
 
Building and Managing Projects with Maven
Building and Managing Projects with MavenBuilding and Managing Projects with Maven
Building and Managing Projects with Maven
 
Node.js & Twitter Bootstrap Crash Course
Node.js & Twitter Bootstrap Crash CourseNode.js & Twitter Bootstrap Crash Course
Node.js & Twitter Bootstrap Crash Course
 
Javascript first-class citizenery
Javascript first-class citizeneryJavascript first-class citizenery
Javascript first-class citizenery
 
Test
TestTest
Test
 
WebApps e Frameworks Javascript
WebApps e Frameworks JavascriptWebApps e Frameworks Javascript
WebApps e Frameworks Javascript
 

Viewers also liked

Viewers also liked (14)

Api Design
Api DesignApi Design
Api Design
 
Rest in practice
Rest in practiceRest in practice
Rest in practice
 
REST API
REST APIREST API
REST API
 
REST API Best (Recommended) Practices
REST API Best (Recommended) PracticesREST API Best (Recommended) Practices
REST API Best (Recommended) Practices
 
Coherent REST API design
Coherent REST API designCoherent REST API design
Coherent REST API design
 
(ATS6-DEV05) Building Interactive Web Applications with the Reporting Collection
(ATS6-DEV05) Building Interactive Web Applications with the Reporting Collection(ATS6-DEV05) Building Interactive Web Applications with the Reporting Collection
(ATS6-DEV05) Building Interactive Web Applications with the Reporting Collection
 
Introduction to the Art of API Practice
Introduction to the Art of API PracticeIntroduction to the Art of API Practice
Introduction to the Art of API Practice
 
Pragmatic REST: recent trends in API design
Pragmatic REST: recent trends in API designPragmatic REST: recent trends in API design
Pragmatic REST: recent trends in API design
 
Enterprise API deployment best practice
Enterprise API deployment best practiceEnterprise API deployment best practice
Enterprise API deployment best practice
 
REST API Design
REST API DesignREST API Design
REST API Design
 
REST API Design for JAX-RS And Jersey
REST API Design for JAX-RS And JerseyREST API Design for JAX-RS And Jersey
REST API Design for JAX-RS And Jersey
 
Rest api design by george reese
Rest api design by george reeseRest api design by george reese
Rest api design by george reese
 
The never-ending REST API design debate
The never-ending REST API design debateThe never-ending REST API design debate
The never-ending REST API design debate
 
What Makes a Great Open API?
What Makes a Great Open API?What Makes a Great Open API?
What Makes a Great Open API?
 

Similar to Our practice of designing and implementing REST-service API for existing system

Intro to node and mongodb 1
Intro to node and mongodb   1Intro to node and mongodb   1
Intro to node and mongodb 1
Mohammad Qureshi
 

Similar to Our practice of designing and implementing REST-service API for existing system (20)

About REST. Архитектурные семинары Softengi
About REST. Архитектурные семинары SoftengiAbout REST. Архитектурные семинары Softengi
About REST. Архитектурные семинары Softengi
 
ASP.NET: Present and future
ASP.NET: Present and futureASP.NET: Present and future
ASP.NET: Present and future
 
Simple REST with Dropwizard
Simple REST with DropwizardSimple REST with Dropwizard
Simple REST with Dropwizard
 
Ada for Web Development
Ada for Web DevelopmentAda for Web Development
Ada for Web Development
 
Be a Hero on Day 1 with ASP.Net Boilerplate
Be a Hero on Day 1 with ASP.Net BoilerplateBe a Hero on Day 1 with ASP.Net Boilerplate
Be a Hero on Day 1 with ASP.Net Boilerplate
 
My weekend startup: seocrawler.co
My weekend startup: seocrawler.coMy weekend startup: seocrawler.co
My weekend startup: seocrawler.co
 
Nodejs web,db,hosting
Nodejs web,db,hostingNodejs web,db,hosting
Nodejs web,db,hosting
 
Building assets on the fly with Node.js
Building assets on the fly with Node.jsBuilding assets on the fly with Node.js
Building assets on the fly with Node.js
 
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
 
The Essentials of Building Cloud-Based Web Apps with Azure
The Essentials of Building Cloud-Based Web Apps with AzureThe Essentials of Building Cloud-Based Web Apps with Azure
The Essentials of Building Cloud-Based Web Apps with Azure
 
Intro to node and mongodb 1
Intro to node and mongodb   1Intro to node and mongodb   1
Intro to node and mongodb 1
 
Web Performance Part 4 "Client-side performance"
Web Performance Part 4  "Client-side performance"Web Performance Part 4  "Client-side performance"
Web Performance Part 4 "Client-side performance"
 
Integrating React.js Into a PHP Application
Integrating React.js Into a PHP ApplicationIntegrating React.js Into a PHP Application
Integrating React.js Into a PHP Application
 
Node.js vs Play Framework
Node.js vs Play FrameworkNode.js vs Play Framework
Node.js vs Play Framework
 
SproutCore and the Future of Web Apps
SproutCore and the Future of Web AppsSproutCore and the Future of Web Apps
SproutCore and the Future of Web Apps
 
Jsp Comparison
 Jsp Comparison Jsp Comparison
Jsp Comparison
 
Chris O'Brien - Best bits of Azure for Office 365/SharePoint developers
Chris O'Brien - Best bits of Azure for Office 365/SharePoint developersChris O'Brien - Best bits of Azure for Office 365/SharePoint developers
Chris O'Brien - Best bits of Azure for Office 365/SharePoint developers
 
GlassFish REST Administration Backend at JavaOne India 2012
GlassFish REST Administration Backend at JavaOne India 2012GlassFish REST Administration Backend at JavaOne India 2012
GlassFish REST Administration Backend at JavaOne India 2012
 
What’s new in Java SE, EE, ME, Embedded world & new Strategy
What’s new in Java SE, EE, ME, Embedded world & new StrategyWhat’s new in Java SE, EE, ME, Embedded world & new Strategy
What’s new in Java SE, EE, ME, Embedded world & new Strategy
 
Deploying your static web app to the Cloud
Deploying your static web app to the CloudDeploying your static web app to the Cloud
Deploying your static web app to the Cloud
 

Our practice of designing and implementing REST-service API for existing system

  • 1.
  • 2.  Anton Bogdan ◦ Architect in Softengi company  (Kiev, Zhitomir, Kharkov)  29 years old  7 years of experience ◦ 5 years of one project ◦ 2 years as an architect 2
  • 3.  Enterprise application for corporate clients(100+)  SaaS, access via browser (ASP.Net).  Heaviest DB for single client - 70Gb (MS SQL)  10+ years in production  1M code-lines  .Net ◦ ASP.Net, Remoting, WCF, WF  MSSQL ◦ Service broker, AlwaysOn Failover Cluster 3
  • 6.  SOAP  /Auth.asmx  /Workflows.asmx  /Tasks.asmx  REST  /sessions/  /processes/workflows/  /processes/tasks/ 6
  • 7.  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 ! 7
  • 8.  /workflows/<Name> ◦ GET - Read ◦ PUT - Update ◦ DELETE - Delete  /workflows/ ◦ POST - Create  201 (Created), Location:<new url> 8
  • 9.  /workflows/<Name>  MOVE  Destination: <new url>  COPY  Destination: <new url>  PATCH  POST /workflows/<Name>/close 9
  • 10.  GET /workflows/  -> String[]  GET /workflows/?created=<2007  -> String[] 10
  • 11. /sql?q=SELECT * FROM workflows WHERE date < 2007 Parsing Validating Transforming Paging SELECT TOP 20 w.id, w.name, w.type, cfv.[Field1] FROM workflows w JOIN permissions p ON p.objectId = w.id JOIN customfieldvalue cfv ON cfv.objectId = w.id AND cfv.name = “Field1” WHERE date < 2007 AND p.userId= <userId> 11
  • 12.  Less Db identifiers  More names and URLs  No .Net/Java specifics: ◦ type: “MyNamespace.Workflow”  No complex inner structures  URL for hierarchies  WebDav - for file systems. 12
  • 13.  400 – Bad request (ParseException, ValidationException)  401 – Unauthorized (wrong Session ID)  404 – Not Found (ObjectDoesNotExistException)  409 – Conflict (ObjectAlreadyExistException)  500 – Unexpected  503 – Service Unavailable 13
  • 14.  Authentication  Session ID in header or cookies  Response Caching  Etags  Throttling  Versioning  api/ver1/* 14
  • 15.  sdk.js (require jquery.js json2.js)  Javascript API: ◦ sdk.auth.authenticate(userName, password, onsuccess, onerror) ◦ sdk.auth.getInfo(onsuccess, onerror) ◦ sdk.auth.end(onsuccess, onerror) ◦ sdk.workflows.create(name, object, onsuccess, onerror) ◦ sdk.workflows.update(name, object, onsuccess, onerror) ◦ sdk.workflows.delete(name, onsuccess, onerror) ◦ … 15
  • 16.  No Date type in JSON spec! - ISO Date  DateTime TZ problems  CORS (server-side + EasyXDM)  HttpRequest: PATCH operation  Files Download/Upload (+ progress) 16
  • 17.  sdk.js+qunit.js+JsTestDriver+TeamCity  DB setup-rollback problems  JS async tests – new for our developers 17
  • 18. 18 asyncTest("Delete workflow - Happy path", 1, function() { var queue = new ActionQueue(this); // Given queue.enqueue(function() { sdk.workflow.createWorkflow(”Wf1", function(response) { queue.executeNext();}, errorHandler); }); // When queue.enqueue(function() { sdk.workflow.deleteWorkflow(”Wf1", function(response) { // Then equal(response.metadata.statusCode, 204, "Status code OK"); }, errorHandler); }); queue.executeNext(); });
  • 19. 19
  • 20.  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.jopera.org/files/soa-amsterdam-restws- pautasso-talk.pdf  http://www.infoq.com/news/2008/05/rest-vs-ws-star  http://www.iana.org/time-zones  http://www.w3.org/TR/cors/  Libs: ◦ http://easyxdm.net/wp/ ◦ https://github.com/bigeasy/timezone 20