იოსებ ძმანაშვილი - the web apis
TRANSCRIPT
![Page 1: იოსებ ძმანაშვილი - The Web APIs](https://reader031.vdocuments.mx/reader031/viewer/2022020208/55a69d3c1a28abe07d8b47c6/html5/thumbnails/1.jpg)
The Web APIs
![Page 2: იოსებ ძმანაშვილი - The Web APIs](https://reader031.vdocuments.mx/reader031/viewer/2022020208/55a69d3c1a28abe07d8b47c6/html5/thumbnails/2.jpg)
Ioseb Dzmanashvili !
!
Software Architect at AzRy LLC !
!
!Twitter: https://twitter.com/iosebiGithub: https://github.com/ioseb
![Page 3: იოსებ ძმანაშვილი - The Web APIs](https://reader031.vdocuments.mx/reader031/viewer/2022020208/55a69d3c1a28abe07d8b47c6/html5/thumbnails/3.jpg)
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.
![Page 4: იოსებ ძმანაშვილი - The Web APIs](https://reader031.vdocuments.mx/reader031/viewer/2022020208/55a69d3c1a28abe07d8b47c6/html5/thumbnails/4.jpg)
What is HTTP?
The Hypertext Transfer Protocol (HTTP) is an application-level protocol for distributed,
collaborative, hypertext information systems. !
Hypertext Transfer Protocol RFC, HTTPbis
![Page 5: იოსებ ძმანაშვილი - The Web APIs](https://reader031.vdocuments.mx/reader031/viewer/2022020208/55a69d3c1a28abe07d8b47c6/html5/thumbnails/5.jpg)
HTTP Has Many Uses/Applications
•Data Transportation
•RPC(Remote Procedure Call)
•Primitive CRUD(Create/Read/Update/Delete)
•Hypermedia Systems
•etc…
![Page 6: იოსებ ძმანაშვილი - The Web APIs](https://reader031.vdocuments.mx/reader031/viewer/2022020208/55a69d3c1a28abe07d8b47c6/html5/thumbnails/6.jpg)
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]
![Page 7: იოსებ ძმანაშვილი - The Web APIs](https://reader031.vdocuments.mx/reader031/viewer/2022020208/55a69d3c1a28abe07d8b47c6/html5/thumbnails/7.jpg)
An application programming interface (API) specifies how some software components should
interact with each other.
What is an API?
![Page 8: იოსებ ძმანაშვილი - The Web APIs](https://reader031.vdocuments.mx/reader031/viewer/2022020208/55a69d3c1a28abe07d8b47c6/html5/thumbnails/8.jpg)
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" }
![Page 9: იოსებ ძმანაშვილი - The Web APIs](https://reader031.vdocuments.mx/reader031/viewer/2022020208/55a69d3c1a28abe07d8b47c6/html5/thumbnails/9.jpg)
Control Oriented ApproachHTTP/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>
![Page 10: იოსებ ძმანაშვილი - The Web APIs](https://reader031.vdocuments.mx/reader031/viewer/2022020208/55a69d3c1a28abe07d8b47c6/html5/thumbnails/10.jpg)
Control Oriented Approach
![Page 11: იოსებ ძმანაშვილი - The Web APIs](https://reader031.vdocuments.mx/reader031/viewer/2022020208/55a69d3c1a28abe07d8b47c6/html5/thumbnails/11.jpg)
Some Basics
![Page 12: იოსებ ძმანაშვილი - The Web APIs](https://reader031.vdocuments.mx/reader031/viewer/2022020208/55a69d3c1a28abe07d8b47c6/html5/thumbnails/12.jpg)
<many different links>
<a href…> <img src…> <link href…> <video…> <audio…> <form action…>
![Page 13: იოსებ ძმანაშვილი - The Web APIs](https://reader031.vdocuments.mx/reader031/viewer/2022020208/55a69d3c1a28abe07d8b47c6/html5/thumbnails/13.jpg)
Method safe idempotent visibility cacheable
GET Yes Yes Yes YesHEAD Yes Yes Yes YesPUT Yes YesDELETE Yes YesPOST(a) PartialPOST(p)
Uniform HTTP Methods
![Page 14: იოსებ ძმანაშვილი - The Web APIs](https://reader031.vdocuments.mx/reader031/viewer/2022020208/55a69d3c1a28abe07d8b47c6/html5/thumbnails/14.jpg)
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
![Page 15: იოსებ ძმანაშვილი - The Web APIs](https://reader031.vdocuments.mx/reader031/viewer/2022020208/55a69d3c1a28abe07d8b47c6/html5/thumbnails/15.jpg)
Though We Often See….
HTTP/1.1 200 OK Content-Type: application/json Content-Length: … !{"error": "Hey dude you fucked up..."}
![Page 16: იოსებ ძმანაშვილი - The Web APIs](https://reader031.vdocuments.mx/reader031/viewer/2022020208/55a69d3c1a28abe07d8b47c6/html5/thumbnails/16.jpg)
7 Lines of Text
![Page 17: იოსებ ძმანაშვილი - The Web APIs](https://reader031.vdocuments.mx/reader031/viewer/2022020208/55a69d3c1a28abe07d8b47c6/html5/thumbnails/17.jpg)
http://service.org/simpsons/ijk
Resource Identifier
![Page 18: იოსებ ძმანაშვილი - The Web APIs](https://reader031.vdocuments.mx/reader031/viewer/2022020208/55a69d3c1a28abe07d8b47c6/html5/thumbnails/18.jpg)
Request Message
GET /simpsons/ijk HTTP/1.1 Host: service.org
![Page 19: იოსებ ძმანაშვილი - The Web APIs](https://reader031.vdocuments.mx/reader031/viewer/2022020208/55a69d3c1a28abe07d8b47c6/html5/thumbnails/19.jpg)
Response MessageHTTP/1.1 200 OK Content-Type: image/jpeg Content-Length: ... !!!!!!!!!!!!
}Representation
![Page 20: იოსებ ძმანაშვილი - The Web APIs](https://reader031.vdocuments.mx/reader031/viewer/2022020208/55a69d3c1a28abe07d8b47c6/html5/thumbnails/20.jpg)
}Interpretation
![Page 21: იოსებ ძმანაშვილი - The Web APIs](https://reader031.vdocuments.mx/reader031/viewer/2022020208/55a69d3c1a28abe07d8b47c6/html5/thumbnails/21.jpg)
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
![Page 22: იოსებ ძმანაშვილი - The Web APIs](https://reader031.vdocuments.mx/reader031/viewer/2022020208/55a69d3c1a28abe07d8b47c6/html5/thumbnails/22.jpg)
The “self” Link Relation Type
Conveys an identifier for the link's context. !
[RFC4287]
![Page 23: იოსებ ძმანაშვილი - The Web APIs](https://reader031.vdocuments.mx/reader031/viewer/2022020208/55a69d3c1a28abe07d8b47c6/html5/thumbnails/23.jpg)
Bart
![Page 24: იოსებ ძმანაშვილი - The Web APIs](https://reader031.vdocuments.mx/reader031/viewer/2022020208/55a69d3c1a28abe07d8b47c6/html5/thumbnails/24.jpg)
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
![Page 25: იოსებ ძმანაშვილი - The Web APIs](https://reader031.vdocuments.mx/reader031/viewer/2022020208/55a69d3c1a28abe07d8b47c6/html5/thumbnails/25.jpg)
The “edit” Link Relation Type
Refers to a resource that can be used to edit the link's context.
![RFC5023]
![Page 26: იოსებ ძმანაშვილი - The Web APIs](https://reader031.vdocuments.mx/reader031/viewer/2022020208/55a69d3c1a28abe07d8b47c6/html5/thumbnails/26.jpg)
Bart
![Page 27: იოსებ ძმანაშვილი - The Web APIs](https://reader031.vdocuments.mx/reader031/viewer/2022020208/55a69d3c1a28abe07d8b47c6/html5/thumbnails/27.jpg)
Bart Apply
![Page 28: იოსებ ძმანაშვილი - The Web APIs](https://reader031.vdocuments.mx/reader031/viewer/2022020208/55a69d3c1a28abe07d8b47c6/html5/thumbnails/28.jpg)
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
![Page 29: იოსებ ძმანაშვილი - The Web APIs](https://reader031.vdocuments.mx/reader031/viewer/2022020208/55a69d3c1a28abe07d8b47c6/html5/thumbnails/29.jpg)
The “collection” Link Relation Type
The target URI points to a resource which represents the collection resource for the
context URI. !
[RFC6573]
![Page 30: იოსებ ძმანაშვილი - The Web APIs](https://reader031.vdocuments.mx/reader031/viewer/2022020208/55a69d3c1a28abe07d8b47c6/html5/thumbnails/30.jpg)
BartSimpsons
![Page 31: იოსებ ძმანაშვილი - The Web APIs](https://reader031.vdocuments.mx/reader031/viewer/2022020208/55a69d3c1a28abe07d8b47c6/html5/thumbnails/31.jpg)
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
![Page 32: იოსებ ძმანაშვილი - The Web APIs](https://reader031.vdocuments.mx/reader031/viewer/2022020208/55a69d3c1a28abe07d8b47c6/html5/thumbnails/32.jpg)
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]
![Page 33: იოსებ ძმანაშვილი - The Web APIs](https://reader031.vdocuments.mx/reader031/viewer/2022020208/55a69d3c1a28abe07d8b47c6/html5/thumbnails/33.jpg)
Bart
Homer
Simpsons
![Page 34: იოსებ ძმანაშვილი - The Web APIs](https://reader031.vdocuments.mx/reader031/viewer/2022020208/55a69d3c1a28abe07d8b47c6/html5/thumbnails/34.jpg)
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
![Page 35: იოსებ ძმანაშვილი - The Web APIs](https://reader031.vdocuments.mx/reader031/viewer/2022020208/55a69d3c1a28abe07d8b47c6/html5/thumbnails/35.jpg)
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]
![Page 36: იოსებ ძმანაშვილი - The Web APIs](https://reader031.vdocuments.mx/reader031/viewer/2022020208/55a69d3c1a28abe07d8b47c6/html5/thumbnails/36.jpg)
Bart
Homer Marge
Simpsons
![Page 37: იოსებ ძმანაშვილი - The Web APIs](https://reader031.vdocuments.mx/reader031/viewer/2022020208/55a69d3c1a28abe07d8b47c6/html5/thumbnails/37.jpg)
Control Oriented Approach
![Page 38: იოსებ ძმანაშვილი - The Web APIs](https://reader031.vdocuments.mx/reader031/viewer/2022020208/55a69d3c1a28abe07d8b47c6/html5/thumbnails/38.jpg)
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
![Page 39: იოსებ ძმანაშვილი - The Web APIs](https://reader031.vdocuments.mx/reader031/viewer/2022020208/55a69d3c1a28abe07d8b47c6/html5/thumbnails/39.jpg)
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
![Page 40: იოსებ ძმანაშვილი - The Web APIs](https://reader031.vdocuments.mx/reader031/viewer/2022020208/55a69d3c1a28abe07d8b47c6/html5/thumbnails/40.jpg)
Questions?