Swagger, language pour décrire des API REST
-
Upload
pierre-andre-vullioud -
Category
Internet
-
view
266 -
download
3
Transcript of Swagger, language pour décrire des API REST
Swagger / JS Meetup 5 mars 2015
Alway’s be watching!
©EP
FL
Qui êtes vous ?
→ Qui crée des APIs ?→ Qui consomme des API→ Combien d’API avez vous utilisées
aujourd’hui ?
Pierre-André Vullioud
watchful.li CTO
Owner of inetis.ch
Joomla enthusiast
@pavullioud
APIs in 2015
source : www.programmableweb.com/api-research
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
http://apievangelist.com/2012/01/12/the-secret-to-amazons-success-internal-apis/
API centric architecture
→ Internal use→ Apps→ Clients→ Partners
Data
API
Functionality
app
partnersservices
Description de votre API
JSON
Technologie agnostique
Accélère le développement
Documentation
https://watchful.li/apidoc-v1/index.html
SDK Generator
https://github.com/swagger-api/swagger-codegen
Javascript
Javascript Class
https://github.com/wcandillon/swagger-js-codegen
Générer dynamiquement un client en Javascript
https://github.com/swagger-api/swagger-js
Client dynamique
var swagger = new client.SwaggerClient({
url: 'http://petstore.swagger.wordnik.com/v2/swagger.json',
success: function() {
swagger.apis.pet.getPetById({petId:1});
}
});
Générer le code
→ avec l’éditeur→ parser le code source
Exemple PHP
https://github.com/zircote/swagger-php/
Questions ?