Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
The Web APIs
Ioseb Dzmanashvili
!
!
Software Architect at AzRy LLC
!
!
!
Twitter: https://twitter.com/iosebi	
Github: https://github.co...
What is Web API?
Web API is an umbrella term and means anything that
is based on core Web protocols and concepts. Namely
H...
What is HTTP?
The Hypertext Transfer Protocol (HTTP) is an
application-level protocol for distributed,
collaborative, hype...
HTTP Has Many Uses/Applications
•Data Transportation
•RPC(Remote Procedure Call) 
•Primitive CRUD(Create/Read/Update/Delet...
What is URI?
A Uniform Resource Identifier (URI) is a compact
sequence of characters that identifies an abstract or
physical...
An application programming interface (API)
specifies how some software components should
interact with each other.
What is ...
Data Oriented Approach
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: …
!
{
"score": 1337,
"playerName": "...
Control Oriented Approach
HTTP/1.1 200 OK
Content-Type: text/html
Cache-Control: private, max-age=0
Content-Length: ...
!
...
Control Oriented Approach
Some Basics
<many different links>
<a href…>
<img src…>
<link href…>
<video…>
<audio…>
<form action…>
Method safe idempotent visibility cacheable
GET Yes Yes Yes Yes
HEAD Yes Yes Yes Yes
PUT Yes Yes
DELETE Yes Yes
POST(a) Pa...
HTTP Response Codes for Dummies
Status Code Range Description
20x Cool.
30x ask that dude over there.
40x you fucked up.
5...
Though We Often See….
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: …
!
{"error": "Hey dude you fucked up...
7 Lines of Text
http://service.org/simpsons/ijk
Resource Identifier
Request Message
GET /simpsons/ijk HTTP/1.1
Host: service.org
Response Message
HTTP/1.1 200 OK
Content-Type: image/jpeg
Content-Length: ...
!
!
!
!
!
!
!
!
!
!
!
!
}Representation
}Interpretation
HTTP/1.1 200 OK
Content-Type: image/jpeg
Content-Length: ...
Link: </simpsons/ijk>; rel="self"; title=“Bart"
!
[BINARY DAT...
The “self” Link Relation Type
Conveys an identifier for the link's context.
!
[RFC4287]
Bart
HTTP/1.1 200 OK
Content-Type: image/jpeg
Content-Length: ...
Link: </simpsons/ijk>; rel="self edit"; title=“Bart"
!
[BINAR...
The “edit” Link Relation Type
Refers to a resource that can be used to
edit the link's context.
!
[RFC5023]
Bart
Bart Apply
HTTP/1.1 200 OK
Content-Type: image/jpeg
Content-Length: ...
Link: </simpsons/ijk>; rel="self edit"; title="Bart",
</simps...
The “collection” Link Relation Type
The target URI points to a resource which
represents the collection resource for the
c...
BartSimpsons
HTTP/1.1 200 OK
Content-Type: image/jpeg
Content-Length: ...
Link: </simpsons/ijk>; rel="self edit"; title="Bart",
</simps...
The “prev” Link Relation Type
Indicates that the link's context is a part of
a series, and that the previous in the
series...
Bart
Homer
Simpsons
HTTP/1.1 200 OK
Content-Type: image/jpeg
Content-Length: ...
Link: </simpsons/ijk>; rel="self edit"; title="Bart",
</simps...
The “next” Link Relation Type
Indicates that the link's context is a part of
a series, and that the next in the series is
...
Bart
Homer Marge
Simpsons
Control Oriented Approach
An affordance is a relationship between the
properties of an object and the capabilities of the
agent that determine just ...
When I say hypertext, I mean the simultaneous
presentation of information and controls
such that the information becomes t...
Questions?
Upcoming SlideShare
Loading in …5
×

იოსებ ძმანაშვილი - The Web APIs

663 views

Published on

სტუდენტური ჰაკათონი - http://macs.unihack.ge/

vido: http://www.youtube.com/watch?v=pWSWImwblQ4&feature=share&list=UUKyScn6UfDhuQ7UINKhyEfQ&index=1

Published in: Technology
  • Be the first to comment

  • Be the first to like this

იოსებ ძმანაშვილი - The Web APIs

  1. 1. The Web APIs
  2. 2. Ioseb Dzmanashvili ! ! Software Architect at AzRy LLC ! ! ! Twitter: https://twitter.com/iosebi Github: https://github.com/ioseb
  3. 3. What is Web API? Web API is an umbrella term and means anything that is based on core Web protocols and concepts. Namely HTTP, URI and Media Types.
  4. 4. What is HTTP? The Hypertext Transfer Protocol (HTTP) is an application-level protocol for distributed, collaborative, hypertext information systems. ! Hypertext Transfer Protocol RFC, HTTPbis
  5. 5. HTTP Has Many Uses/Applications •Data Transportation •RPC(Remote Procedure Call) •Primitive CRUD(Create/Read/Update/Delete) •Hypermedia Systems •etc…
  6. 6. What is URI? A Uniform Resource Identifier (URI) is a compact sequence of characters that identifies an abstract or physical resource. ! Uniform Resource Identifier [RFC3986]
  7. 7. An application programming interface (API) specifies how some software components should interact with each other. What is an API?
  8. 8. Data Oriented Approach HTTP/1.1 200 OK Content-Type: application/json Content-Length: … ! { "score": 1337, "playerName": "Sean Plott", "cheatMode": false, "createdAt": "2011-08-20T02:06:57.931Z", "updatedAt": "2011-08-20T02:06:57.931Z", "objectId": "Ed1nuqPvcm" }
  9. 9. Control Oriented Approach HTTP/1.1 200 OK Content-Type: text/html Cache-Control: private, max-age=0 Content-Length: ... ! <!DOCTYPE html> <html> <head> <title>Hello World</title> <link rel="stylesheet" href="style.css" type="text/css"> </head> <body> <section> <header> <img src="/logo.png"> </header> <form method="post" action="/users" enctype="..."> <label> User name: <input type="text" name="user-name"> </label> <button type="submit" name="create">Create</button> </form> </section> </body> </html>
  10. 10. Control Oriented Approach
  11. 11. Some Basics
  12. 12. <many different links> <a href…> <img src…> <link href…> <video…> <audio…> <form action…>
  13. 13. Method safe idempotent visibility cacheable GET Yes Yes Yes Yes HEAD Yes Yes Yes Yes PUT Yes Yes DELETE Yes Yes POST(a) Partial POST(p) Uniform HTTP Methods
  14. 14. HTTP Response Codes for Dummies Status Code Range Description 20x Cool. 30x ask that dude over there. 40x you fucked up. 50x we fucked up. @DanaDanger
  15. 15. Though We Often See…. HTTP/1.1 200 OK Content-Type: application/json Content-Length: … ! {"error": "Hey dude you fucked up..."}
  16. 16. 7 Lines of Text
  17. 17. http://service.org/simpsons/ijk Resource Identifier
  18. 18. Request Message GET /simpsons/ijk HTTP/1.1 Host: service.org
  19. 19. Response Message HTTP/1.1 200 OK Content-Type: image/jpeg Content-Length: ... ! ! ! ! ! ! ! ! ! ! ! ! }Representation
  20. 20. }Interpretation
  21. 21. HTTP/1.1 200 OK Content-Type: image/jpeg Content-Length: ... Link: </simpsons/ijk>; rel="self"; title=“Bart" ! [BINARY DATA HERE] The “self” Link Relation Type
  22. 22. The “self” Link Relation Type Conveys an identifier for the link's context. ! [RFC4287]
  23. 23. Bart
  24. 24. HTTP/1.1 200 OK Content-Type: image/jpeg Content-Length: ... Link: </simpsons/ijk>; rel="self edit"; title=“Bart" ! [BINARY DATA HERE] The “edit” Link Relation Type
  25. 25. The “edit” Link Relation Type Refers to a resource that can be used to edit the link's context. ! [RFC5023]
  26. 26. Bart
  27. 27. Bart Apply
  28. 28. HTTP/1.1 200 OK Content-Type: image/jpeg Content-Length: ... Link: </simpsons/ijk>; rel="self edit"; title="Bart", </simpsons/>; rel="collection"; title="The Simpsons” ! [BINARY DATA HERE] The “collection” Link Relation Type
  29. 29. The “collection” Link Relation Type The target URI points to a resource which represents the collection resource for the context URI. ! [RFC6573]
  30. 30. BartSimpsons
  31. 31. HTTP/1.1 200 OK Content-Type: image/jpeg Content-Length: ... Link: </simpsons/ijk>; rel="self edit"; title="Bart", </simpsons/>; rel="collection"; title="The Simpsons", </simpsons/abc>; rel="prev"; type="image/gif"; title=“Homer" ! [BINARY DATA HERE] The “prev” Link Relation Type
  32. 32. The “prev” Link Relation Type Indicates that the link's context is a part of a series, and that the previous in the series is the link target. ! [HTML Spec]
  33. 33. Bart Homer Simpsons
  34. 34. HTTP/1.1 200 OK Content-Type: image/jpeg Content-Length: ... Link: </simpsons/ijk>; rel="self edit"; title="Bart", </simpsons/>; rel="collection"; title="The Simpsons", </simpsons/abc>; rel="prev"; type="image/gif"; title="Homer", </simpsons/xyz>; rel="next"; type="image/png"; title=“Marge" ! [BINARY DATA HERE] The “next” Link Relation Type
  35. 35. The “next” Link Relation Type Indicates that the link's context is a part of a series, and that the next in the series is the link target. ! [HTML Spec]
  36. 36. Bart Homer Marge Simpsons
  37. 37. Control Oriented Approach
  38. 38. An affordance is a relationship between the properties of an object and the capabilities of the agent that determine just how the object could possibly be used. … Think of each action by the user as an attempt to step in the right direction; an error is simply an action that is incompletely or improperly specified. Try support, not to fight, the user's responses. Design explorable systems. ! Don Norman
  39. 39. When I say hypertext, I mean the simultaneous presentation of information and controls such that the information becomes the affordance through which the user (or automaton) obtains choices and selects actions ! Roy T. Fielding 2008
  40. 40. Questions?

×