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
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
16. No Date type in JSON spec! - ISO Date
DateTime TZ problems
CORS (server-side + EasyXDM)
HttpRequest: PATCH operation
Files Download/Upload (+ progress)
16