okupljanje korisnika isvu rest api u isvu...22. siječnja 2014. http metode i crud operacije (2) •...
Post on 28-Dec-2019
2 Views
Preview:
TRANSCRIPT
22. siječnja 2014.
Okupljanje korisnika ISVU
-
REST API u ISVU
22. siječnja 2014.
Program• 12:00 - 12:20 „Uvodna riječ - Zašto REST API?” - Denis Kranjčec, Srce
• 12:20 - 12:40 „Kako je implementiran ISVU REST API?” - Estera Prendivoj, Srce
• 12:40 - 13:10 „Tehničko veleučilište u Zagrebu” -
Ivica Dodig, Ivan Cesar i Davor Cafuta
• 13:10 - 13:25 „ISVU REST API na FOI, stanje i planovi” -
Darko Grabar i Željko Šmaguc, FOI
• 13:25 - 13:45 pauza
• 13:45 - 14:00 „NEO-MRKVE” - doc. dr. sc. Alfonzo Baumgartner, dipl. ing, ETFOS
• 14:00 - 14:15 „Primjena digitalne olovke u ISVU sustavu” -
doc. dr. sc. Irena Galić, prof., ETFOS
• 14:15 - 14:30 „ISVU API kao potpora sustavu za e-učenje Medicinskog fakulteta
Sveučilišta u Zagrebu” - Andrej Vitez, MEF
• 14:30 - 14:45 „Povezivanje sustava Merlin s ISVU-om” - Zvonko Martinović, Srce
• 14:45 - 15:05 pauza
• 15:05 - 15:35 „Quilt CMS is so 'API!” -
Svebor Prstačić, Siniša Tomić i Vlatka Paunović, FER
• 15:35 - 15:55 „ISVU REST API u 2014+” - Denis Kranjčec, Srce
• 15:55 - 16:15 Razgovor
22. siječnja 2014.
Zašto REST API?
Denis Kranjčec, Srcedenis.kranjcec@srce.hr
22. siječnja 2014.
Što je REST? (1)
• „Representational State Transfer (REST) is a style of
software architecture for distributed systems such as
the World Wide Web.”https://en.wikipedia.org/wiki/Representational_state_transfer
• „The term representational state transfer was
introduced and defined in 2000 by Roy Fielding in his
doctoral dissertation.”http://www.ics.uci.edu/~fielding/pubs/dissertation/top.htm
http://www.ics.uci.edu/~fielding/pubs/dissertation/rest_arch_style.htm
22. siječnja 2014.
Što je REST? (2)
• Constraints
– Client–server
– Stateless
– Cacheable
– Layered system
– Uniform interface
• „REST is defined by four interface constraints: identification of
resources; manipulation of resources through representations;
self-descriptive messages; and, hypermedia as the engine of
application state.”
– Code on demand (optional)
22. siječnja 2014.
Richardson Maturity Model
• Level 0
– One URI
– SOAP, XML RPC, POX
22. siječnja 2014.
Richardson Maturity Model
• Level 0
– One URI
– SOAP, XML RPC, POX
• Level 1
– Many URIs
– One HTTP method
22. siječnja 2014.
Richardson Maturity Model
• Level 0
– One URI
– SOAP, XML RPC, POX
• Level 1
– Many URIs
– One HTTP method
• Level 2
– Many URIs
– Multiple HTTP methods
22. siječnja 2014.
Richardson Maturity Model
• Level 0
– One URI
– SOAP, XML RPC, POX
• Level 1
– Many URIs
– One HTTP method
• Level 2
– Many URIs
– Multiple HTTP methods
• Level 3
– Level2 + Hypermedia (Resources decribe their own capabilities and
interconnections)
22. siječnja 2014.
Richardson Maturity Model
• Level 0
– One URI
– SOAP, XML RPC, POX
• Level 1
– Many URIs
– One HTTP method
• Level 2
– Many URIs
– Multiple HTTP methods
• Level 3
– Level2 + Hypermedia (Resources decribe their own capabilities and
interconnections)
ISVU REST API
22. siječnja 2014.
Što je REST? (3)
• „REST is software design on the scale of decades:
every detail is intended to promote software longevity
and independent evolution. Many of the constraints
are directly opposed to short-term efficiency.Unfortunately, people are fairly good at short-term design, and
usually awful at long-term design.” - Roy Fielding
• „A truly RESTful API looks like hypertext.” – Roy
Fielding
22. siječnja 2014.
Dizajn reprezentacije resursa
• „A resource is not the thing that is transferred across
the wire... [that] is only a representation.” – Roy
Fielding
• Dizajn reprezentacije resursa:
– Zahtjeva ekspertno znanje o domeni
– Nezavisan je od implementacije
– Korisno ga je prilagoditi use case-u
22. siječnja 2014.
HTTP metode i CRUD operacije (1)
• Create = PUT ?
• Retrieve = GET ?
• Update = POST ?
• Delete = DELETE ?
• http://www.w3.org/Protocols/rfc2616/rfc2616-
sec9.html
Hypertext Transfer Protocol -- HTTP/1.1
RFC 2616 Fielding, et al.
Method Definitions
22. siječnja 2014.
HTTP metode i CRUD operacije (2)
• Create = PUT if and only if you are sending the full content of
the specified resource (URL).
• Create = POST if you are sending a command to the server to
create a subordinate of the specified resource, using some
server-side algorithm.
• Retrieve = GET.
• Update = PUT if and only if you are updating the full content of
the specified resource.
• Update = POST if you are requesting the server to update one
or more subordinates of the specified resource.
• Delete = DELETE.
22. siječnja 2014.
Verzioniranje API-ja
• „Content negotiation is a mechanism defined in the
HTTP specification that makes it possible to serve
different resource representation at the same
URI...”https://en.wikipedia.org/wiki/Content_negotiation
• http://www.primjer.hr/student
• Accept: application/vnd.student-v1+xml
• Accept: application/vnd.student-v2+xml
• Accept: application/vnd.student+json
• Accept-Language, Accept-Encodinghttp://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html (Header Field Definitions)
22. siječnja 2014.
Obrada pogrešaka
• Obavezno koristiti ispravne HTTP status codeshttp://restpatterns.org/HTTP_Status_Codes
– 1xx - Informational
– 2xx - Successful
– 3xx - Redirection
– 4xx - Client Error
– 5xx - Server Error
22. siječnja 2014.
REST
• RESTful Web APIs
– Leonard Richardson, Mike Amundsen, Sam Ruby
• REST in Practice
– Jim Webber, Savas Parastatidis, Ian Robinson
• rest-discuss · The REST Architectural Style
List
– http://tech.groups.yahoo.com/group/rest-
discuss/
• Roy T. Fielding (@fielding)
– http://roy.gbiv.com/untangled/
• Mike Amundsen (@mamund)
– http://amundsen.com/
• ...
22. siječnja 2014.
Zašto REST API?
Denis Kranjčec, Srcedenis.kranjcec@srce.hr
top related