Your SlideShare is downloading. ×
Taking a REST and being HAPI
Upcoming SlideShare
Loading in...5

Thanks for flagging this SlideShare!

Oops! An error has occurred.

Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Taking a REST and being HAPI


Published on

Slides from J and Beyond 2013 presentation. …

Slides from J and Beyond 2013 presentation.

You have probably heard of REST and Web Services. In this presentation you will learn what they are and why they are important to the future of Joomla. You will learn why it is important for the API to be HAPI, what the HATEOAS constraint is and why developers should always keep it in mind when writing clients and servers on the new API, and why moving to a services-first design philosophy is important for everyone involved in Joomla software development.

Published in: Technology

  • Be the first to comment

No Downloads
Total Views
On Slideshare
From Embeds
Number of Embeds
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

No notes for slide


  • 1. and being HAPITaking a RESTChris DavenportJoomla Production Leadership Team
  • 2. Architectural Style of the Web"The World Wide Web has succeeded in largepart because its software architecture has beendesigned to meet the needs of an Internet-scale distributed hypermedia system."Fielding, Roy Thomas. Architectural Styles and the Design of Network-based Software Architectures.Doctoral dissertation, University of California, Irvine, 2000.
  • 3. Web experiences growing pains
  • 4. Web standards adjustedFielding: Analysis of network-based softwarearchitectures● Key constraints give rise to desiredproperties● Internet-scale distributed hypermediaAdjustments/corrections made● HTTP/1.1 RFC 2616● Uniform Resource Identifiers RFC 3986● and others
  • 5. Web saved! Hurray!(2008: Google reaches 1 trillion unique URLs)
  • 6. What is REST?2000: Fieldings PhD dissertation● REST (Representational State Transfer)● Architectural style for building scalable,distributed, hypermedia applications.● The architectural style that has been usedto guide the design and development ofthe World Wide Webs architecture.
  • 7. REST constraints● client-server● stateless● cache● uniform interface● layered system● code-on-demand (optional)The important point is to not unintentionallyviolate these constraints.
  • 8. Client-serverClient and server may be● developed at different times● by different people● evolving at different ratesBut they must always have aShared Understanding
  • 9. Resource-basedResources are identified by This might be the same resource at some point in
  • 10. Manipulation of resources viarepresentationsCeci nest pas une pipeTranslation: "This is not a pipe"
  • 11. Self-descriptive messagesThere must be enough information in eachmessage for the recipient to understand it.Self-contained messages have their limits.There will always be out-of-band informationneeded to understand messages. The problemis where to draw the line.
  • 12. Hypermedia constraintHypermedia as the engine of application state● Clients drive application state by○ following hypermedia links○ or submitting forms● Clients should treat URLs as opaque○ except for URI Templates (RFC 6570)● Fielding: "Servers must have the freedom tocontrol their own namespace"○ Servers can change URIs without breaking clients
  • 13. What about Joomla?SharedcodeSiteAdminModulesWebbrowserHTMLServer (Joomla)Client
  • 14. What about Joomla?SharedcodeSiteAdminModulesWebbrowserHTMLServer (Joomla)ClientAJAXJSON
  • 15. What about Joomla?● Mobile (and other) devices● Internet of Things● Open data● Integrating business processes● Electronic Data Interchange (EDI)
  • 16. Joomla is an information siloComponents cant easilycommunicate with each other
  • 17. Joomla Hypermedia Services● Break Joomla components/modules intosmaller "services".● Services have a uniform interface○ JInput for input○ JSON, XML, HAL, etc. for output● Services communicate using media types○ application/vnd.joomla.*○ Additional constraints using schemas/profiles
  • 18. Joomla Next?ServicesDeviceServerHALHALHAPIServer (Joomla)
  • 19. application/hal+*Resource representation_embedded _linksrel hrefrel hrefrel href
  • 20. Joomla Next?ServicesSite UIAdminUIWebbrowserHTMLHTMLHALHALServer (Joomla)ClientHAPI
  • 21. Joomla Next?ServicesSite UIAdminUIWebbrowserAJAXHALHTMLHTMLHALHALServer (Joomla)ClientHAPI
  • 22. Joomla Next?ServicesSite UIAdminUIHALHALServer (Joomla)ClientWeb browserHAPI
  • 23. Joomla Next?ServicesDeviceServerHALHALServer (Joomla)CLIHALDaemonHALHAPI HAPI
  • 24. Joomla Next?ServicesUIWeb browserHTML HALServer (Joomla)ClientHAPIServicesHALAnother serverHAPIUI
  • 25. Whats inside a service?ServicesServer (Joomla)HAPICMVRAD/SDK/FoFCLIDrupal 8HAPI
  • 26. Web Services Working Group● Web Services Specification○ currently at second draft● Sample code○ based on new MVC in Joomla 3.x○ structure allows it to be retrofitted to any componentwithout touching existing code○ articles, weblinks, categories○ can be browsed with any generic HAL client
  • 27. application/vnd.joomla.*+hal+*Resource representation_embedded _links _metarel hrefrel hrefrel href
  • 28. Hierarchy of media typesJSONHALvnd.joomla.servicevnd.joomla.listvnd.joomla.itemXMLRemember: Shared understanding
  • 29. WSWG Next Steps● Web Services Specification○ more people to read and comment● Coding○ more people to write code for a J3.x implementation○ client SDK (JavaScript and PHP versions)● Future○ more people to work on an architecture for Joomlabeyond the 3.x cycle
  • 30. Questions?Play with a demo at you for listening
  • 31. Image credits License: GNUFDL License: CC-A-SA 2.0 License: CC-A 3.0 License: GNU FDL License: Public domain