Your SlideShare is downloading. ×
0
Don't worry be API with Slim framework and Joomla
Don't worry be API with Slim framework and Joomla
Don't worry be API with Slim framework and Joomla
Don't worry be API with Slim framework and Joomla
Don't worry be API with Slim framework and Joomla
Don't worry be API with Slim framework and Joomla
Don't worry be API with Slim framework and Joomla
Don't worry be API with Slim framework and Joomla
Don't worry be API with Slim framework and Joomla
Don't worry be API with Slim framework and Joomla
Don't worry be API with Slim framework and Joomla
Don't worry be API with Slim framework and Joomla
Don't worry be API with Slim framework and Joomla
Don't worry be API with Slim framework and Joomla
Don't worry be API with Slim framework and Joomla
Don't worry be API with Slim framework and Joomla
Don't worry be API with Slim framework and Joomla
Don't worry be API with Slim framework and Joomla
Don't worry be API with Slim framework and Joomla
Don't worry be API with Slim framework and Joomla
Don't worry be API with Slim framework and Joomla
Don't worry be API with Slim framework and Joomla
Don't worry be API with Slim framework and Joomla
Don't worry be API with Slim framework and Joomla
Don't worry be API with Slim framework and Joomla
Don't worry be API with Slim framework and Joomla
Don't worry be API with Slim framework and Joomla
Don't worry be API with Slim framework and Joomla
Don't worry be API with Slim framework and Joomla
Don't worry be API with Slim framework and Joomla
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

Don't worry be API with Slim framework and Joomla

1,872

Published on



Jab14 exemple of integration of Joomla and slim Framework

http://jandbeyond.org/program/sessions/dont-worry-be-api-best-practices-and-implementatio.html

In the context of a website or web application, an application-programming interface or API allows software developers to interact with and build upon the data and/or services delivered by your website. Thus, APIs provide limitless flexibility, reach and innovative potential for any website, service or application.

During the last few months, Pierre-André has performed extensive research and development to discover effective ways of adding an API to a Joomla website. In this interactive session, he will share his findings.

Attendees can expect to learn, why you need an API for your web site, the pros and cons of various API solutions, and why a RESTful API is a good fit for Joomla. Best practices for implementing a well-documented, pragmatic, and RESTful API will be discussed, along with useful tools and sample code for using the com_api component as well as Slim Framework.

Published in: Internet, Technology
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
1,872
On Slideshare
0
From Embeds
0
Number of Embeds
6
Actions
Shares
0
Downloads
20
Comments
0
Likes
1
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. Don't worry be “API” / JaB 2014 Frankfurt©Flickr-JensMayer
  • 2. How are you ? → Have an API or plan one ? → Developer / designer / integrator ? → How many APIs have you already use today ?
  • 3. Pierre-André Vullioud Watchful.li CTO Joomla enthusiast Owner of inetis.ch #pavullioud
  • 4. APIs in 2014 source : www.programmableweb.com/api-research
  • 5. Amazon → All teams will expose their data and functionality through API. → There will be no other form of interprocess communication [..] → Anyone who doesn't do this will be fired. Amazon policy set by Jeff Bezos in 2003
  • 6. Open your system → Internal use → Apps → Clients → Partners Data API Functionality app partners services
  • 7. REST Everything is a resource verbs : GET, PUT, POST, DELETE, PATCH GET /sessions
  • 8. Relations GET /speakers/12/sessions
  • 9. Filtering, sorting, GET /sessions?date=20140601 GET /sessions?sort=+date,+name
  • 10. Limit fields, callback GET /sessions?fields=date,name,id GET /sessions?callback=myFunction
  • 11. API interfaces for Joomla J!1.5 : XML-RPC J!2.5 : com_api J!3.2 : com_ajax and com_api External solution : Slim Framework
  • 12. com_api for J! 2.5 & 3.x a component by Techjoomla extended by plugins Example of call : index.php? option=com_api&app=jab&format=raw&resource=sessions&id=14&api _key=123456qwert12 http://techjoomla.com/rest-api-for-joomla
  • 13. com_api Pro inside Joomla compatible 2.5/3.x Con code based on J!1.5 URL not clean or fight with router.php
  • 14. com_ajax Since J! 3.2 in the core Extended by plugins & modules First use for intern ajax call Example of call : index.php? option=com_ajax&plugin=session&format=json http://docs.joomla.org/Using_Joomla_Ajax_Interface
  • 15. com_ajax Pro core of Joomla compatible J!1.5/2.5/3.x Con URLs not clean
  • 16. Slim Framework PHP micro framework REST URLs based Light Example of call : /api/v1/sessions/12 slimframework.com
  • 17. Slim Framework Pro Clean URLs RESTFull Cons Not inside J! Need to learn
  • 18. Files api/ Slim v1/ {..} .htaccess index.php End point = https://mysite. com/api/v1/session
  • 19. Weeding J!Slim require_once ( JPATH_BASE . '/includes/defines.php' ); require_once ( JPATH_BASE . '/includes/framework.php' ); $application = & JFactory::getApplication('site'); $application->initialise(); require '../Slim/Slim.php';
  • 20. Add Middleware $app = new SlimSlim $app->_db = JFactory::getDbo(); $app->view(new JsonApiView()); $app->add(new JsonApiMiddleware());
  • 21. Define route and execute $app->get('/', function() use ($app) { $app->render(200, array( 'msg' => 'You reach the JAB API V1' )); }); $app->map('/sessions/', function() use ($app) { ...})->via('GET'); $app->map('/sessions/:id', function($id) use ($app) { ...})->via ('GET'); $app->run();
  • 22. Demo
  • 23. Documentation API is only as good as its documentation
  • 24. Swagger describing, producing, consuming, and visualizing RESTful web services Specification: https://github.com/wordnik/swagger-spec Swagger™ Demo: http://petstore.swagger.wordnik.com/
  • 25. PHP comments * @SWGApi( * path="/logs/metadata", * @SWGOperation( * method="GET", * summary="Get the list of fields", * notes="Returns a list of fields", * type="Logs", * nickname="getFieldsLogs" (…)
  • 26. Parse the code Code Parser JSON output
  • 27. Use it Generate online documentation http://petstore.swagger.wordnik.com/ Generate clients in different languages https://github.com/wordnik/swagger-codegen Share you api : http://apicommons.org/apis.html
  • 28. Other tools Consoles : App for chrome Online console API proxy : http://apigee.com http://www.3scale.net http://www.mashery.com/
  • 29. Questions ?
  • 30. Ressources Github : https://github. com/pvullioud/joomla-slimframework

×