SlideShare una empresa de Scribd logo
1 de 22
Descargar para leer sin conexión
Введение в REST API
Подходы к генерации API документации


               Oleg Zinchenko
             oleg@exercise.com
О себе

Symfony разработчик с 2009 года

TeamLead в Exercise.com

Продвигаю Symfony2 в массы




https://twitter.com/1cdecoder
https://github.com/cystbear
http://cystbear.tumblr.com/
Exercise.com
 Программы    Видео
 Питание      Советы тренера
 Упражнения   Френды, лайки




                               Oleg Zinchenko
REST

  REpresentational State Transfer
                           Передача состояний

   Over HTTP
   State-less
   Кеширование




                                                Oleg Zinchenko
REST

  ACTIONS (HTTP METHODS)
   GET
   POST
   PUT/PATCH
   DELETE




                           Oleg Zinchenko
REST

  RESTful web API

  GET      /api/v1/orders
  POST     /api/v1/orders
  GET      /api/v1/orders/12
  PUT      /api/v1/orders/12
  DELETE   /api/v1/orders/12
  GET      /api/v1/orders/12/delete   forbidden




                                              Oleg Zinchenko
Задача




         Oleg Zinchenko
Задача
{
    "firstName": "Иван",
      "lastName": "Иванов",
      "address": {
      "streetAddress": "Московское ш., 101, кв.101",
        "city": "Ленинград",
        "postalCode": 101101
    },
      "phoneNumbers": [
      "812 123-1234",
      "916 123-4567"]
}

<person>
 <firstName>Иван</firstName>
 <lastName>Иванов</lastName> <address>
  <streetAddress>Московское ш., 101, кв.101</streetAddress>
  <city>Ленинград</city>
  <postalCode>101101</postalCode>
 </address>

 <phoneNumbers>
  <phoneNumber>812 123-1234</phoneNumber>
  <phoneNumber>916 123-4567</phoneNumber>
 </phoneNumbers>
</person>

                                                              Oleg Zinchenko
Bundles


  FOSRestBundle
   FOSRest

  JMSSerializerBundle
    jms/metadata




                        Oleg Zinchenko
2 Kernels


 AppKernel
 ApiKernel
   Разный набор конфигов
   Разный набор бандлов




                           Oleg Zinchenko
authentication + authorization



        authentication + authorization




                                         Oleg Zinchenko
Authentication




                 http://www.xml.com/pub/a/2003/12/17/dive.html

                                                     Oleg Zinchenko
Serialization

 Serializer map
  DemoAcmeDocumentFood:
    exclusion_policy: ALL
    properties:
      calories:
         expose: true
      caloriesPerServing:
         expose: true
      caloriesPerGram:
         expose: true
      caloriesPerFluidOunce:
         expose: true
      measurement:
         expose: true
      servingOptions:
         expose: true
    callback_methods:
      pre_serialize: [prepareMeasurement, prepareServingOptions]




                                                                   Oleg Zinchenko
Serialization

 Object Handlers
  {
      "id": "4fb1fb87944c4c0e240004de",
      "slug": "minimalist-article",
      "title": "Minimalist article",
      "updated_at": "2012-05-15T09:45:26+0300",
      "summary": "Minimalist summary",
      "body": "Minimalist body",
      "main_image": "http://e.com/upl/art/thum/parrot.mobile_client_medium.v1.jpg"
  }




                                                                                     Oleg Zinchenko
Тестирование

Behat
Buzz + aka WebApiContext
 Scenario: /foods get list of food. Pagination supported.
   Given I authorized as: "fred"
   When I make "GET" request to the "/api/v1/foods"
   Then the response status code should be: "200"
   And the response body should be similar to JSON:
     """
     [{"id":"4fb1fb8f944c4c0e24000622","slug":"bittermelon-cooked-a… }]
     """




                                                                          Oleg Zinchenko
Документация

Hippo doc
Swagger
NelmioApiDocBundle




                     Oleg Zinchenko
Документация
Hippo doc




http://api.jirafe.com/

                         Oleg Zinchenko
Документация
Swagger
 apis: [{
   path: "/pet.{format}/{petId}",
   description: "Operations about pets",
   operations: [{
     httpMethod: "GET",
     nickname: "getPetById",
     responseClass: "Pet",
     parameters: [...]
     summary: "Find pet by its unique ID"
     notes: "Only Pets which you have permission to see will be returned",
     errorResponses: [...]
   }]
 }




http://swagger.wordnik.com/
                                                                             Oleg Zinchenko
Документация
Swagger




http://swagger.wordnik.com/
                              Oleg Zinchenko
Документация
   NelmioApiDocBundle
/**
 * This the documentation description of your method, it will appear
 * on a specific pane. It will read all the text until the first
 * annotation.
 *
 * @ApiDoc(
 * resource=true,
 * description="This is a description of your API method",
 * filters={
 *      {"name"="a-filter", "dataType"="integer"},
 *      {"name"="another-filter", "dataType"="string", "pattern"="(foo|bar) ASC|DESC"}
 * }
 * )
 */
public function getAction()
{
}




https://github.com/nelmio/NelmioApiDocBundle
                                                                             Oleg Zinchenko
Документация
 NelmioApiDocBundle




https://github.com/nelmio/NelmioApiDocBundle
                                               Oleg Zinchenko
Спасибо




          Вопросы?




                     Oleg Zinchenko

Más contenido relacionado

La actualidad más candente

Perkenalan ReasonML
Perkenalan ReasonMLPerkenalan ReasonML
Perkenalan ReasonMLRiza Fahmi
 
Stanford Hackathon - Puppet Modules
Stanford Hackathon - Puppet ModulesStanford Hackathon - Puppet Modules
Stanford Hackathon - Puppet ModulesPuppet
 
Nigel hamilton-megameet-2013
Nigel hamilton-megameet-2013Nigel hamilton-megameet-2013
Nigel hamilton-megameet-2013trexy
 
Java libraries you can't afford to miss
Java libraries you can't afford to missJava libraries you can't afford to miss
Java libraries you can't afford to missAndres Almiray
 
Pragmatic Browser Automation with Geb - GIDS 2015
Pragmatic Browser Automation with Geb - GIDS 2015Pragmatic Browser Automation with Geb - GIDS 2015
Pragmatic Browser Automation with Geb - GIDS 2015Naresha K
 
Shell scripting - By Vu Duy Tu from eXo Platform SEA
Shell scripting - By Vu Duy Tu from eXo Platform SEAShell scripting - By Vu Duy Tu from eXo Platform SEA
Shell scripting - By Vu Duy Tu from eXo Platform SEAThuy_Dang
 
Smolder @Silex
Smolder @SilexSmolder @Silex
Smolder @SilexJeen Lee
 
plackdo, plack-like web interface on perl6
plackdo, plack-like web interface on perl6plackdo, plack-like web interface on perl6
plackdo, plack-like web interface on perl6Nobuo Danjou
 
2010/7/31 LTの虎@LL Tiger
2010/7/31 LTの虎@LL Tiger2010/7/31 LTの虎@LL Tiger
2010/7/31 LTの虎@LL TigerAkihiro Okuno
 
Real time server
Real time serverReal time server
Real time serverthepian
 
Node child process
Node child processNode child process
Node child processLearningTech
 
Asynchonicity: concurrency. A tale of
Asynchonicity: concurrency. A tale ofAsynchonicity: concurrency. A tale of
Asynchonicity: concurrency. A tale ofJoel Lord
 
I, For One, Welcome Our New Perl6 Overlords
I, For One, Welcome Our New Perl6 OverlordsI, For One, Welcome Our New Perl6 Overlords
I, For One, Welcome Our New Perl6 Overlordsheumann
 
Great Developers Steal
Great Developers StealGreat Developers Steal
Great Developers StealBen Scofield
 

La actualidad más candente (20)

Perkenalan ReasonML
Perkenalan ReasonMLPerkenalan ReasonML
Perkenalan ReasonML
 
Stanford Hackathon - Puppet Modules
Stanford Hackathon - Puppet ModulesStanford Hackathon - Puppet Modules
Stanford Hackathon - Puppet Modules
 
Nigel hamilton-megameet-2013
Nigel hamilton-megameet-2013Nigel hamilton-megameet-2013
Nigel hamilton-megameet-2013
 
Java libraries you can't afford to miss
Java libraries you can't afford to missJava libraries you can't afford to miss
Java libraries you can't afford to miss
 
Pragmatic Browser Automation with Geb - GIDS 2015
Pragmatic Browser Automation with Geb - GIDS 2015Pragmatic Browser Automation with Geb - GIDS 2015
Pragmatic Browser Automation with Geb - GIDS 2015
 
Shell scripting - By Vu Duy Tu from eXo Platform SEA
Shell scripting - By Vu Duy Tu from eXo Platform SEAShell scripting - By Vu Duy Tu from eXo Platform SEA
Shell scripting - By Vu Duy Tu from eXo Platform SEA
 
Play á la Rails
Play á la RailsPlay á la Rails
Play á la Rails
 
Smolder @Silex
Smolder @SilexSmolder @Silex
Smolder @Silex
 
Cooking with Chef
Cooking with ChefCooking with Chef
Cooking with Chef
 
plackdo, plack-like web interface on perl6
plackdo, plack-like web interface on perl6plackdo, plack-like web interface on perl6
plackdo, plack-like web interface on perl6
 
2010/7/31 LTの虎@LL Tiger
2010/7/31 LTの虎@LL Tiger2010/7/31 LTの虎@LL Tiger
2010/7/31 LTの虎@LL Tiger
 
Real time server
Real time serverReal time server
Real time server
 
Node child process
Node child processNode child process
Node child process
 
Asynchonicity: concurrency. A tale of
Asynchonicity: concurrency. A tale ofAsynchonicity: concurrency. A tale of
Asynchonicity: concurrency. A tale of
 
groovy & grails - lecture 2
groovy & grails - lecture 2groovy & grails - lecture 2
groovy & grails - lecture 2
 
clonehd01
clonehd01clonehd01
clonehd01
 
Elixir on Containers
Elixir on ContainersElixir on Containers
Elixir on Containers
 
Socket.IO
Socket.IOSocket.IO
Socket.IO
 
I, For One, Welcome Our New Perl6 Overlords
I, For One, Welcome Our New Perl6 OverlordsI, For One, Welcome Our New Perl6 Overlords
I, For One, Welcome Our New Perl6 Overlords
 
Great Developers Steal
Great Developers StealGreat Developers Steal
Great Developers Steal
 

Destacado

Sunshine php practical-zf1-zf2-migration
Sunshine php practical-zf1-zf2-migrationSunshine php practical-zf1-zf2-migration
Sunshine php practical-zf1-zf2-migrationClark Everetts
 
Moving a high traffic ZF1 Enterprise Application to SF2 - Lessons learned
Moving a high traffic ZF1 Enterprise Application to SF2 - Lessons learnedMoving a high traffic ZF1 Enterprise Application to SF2 - Lessons learned
Moving a high traffic ZF1 Enterprise Application to SF2 - Lessons learnedBaldur Rensch
 
Is your code ready for PHP 7 ?
Is your code ready for PHP 7 ?Is your code ready for PHP 7 ?
Is your code ready for PHP 7 ?Wim Godden
 
The promise of asynchronous php
The promise of asynchronous phpThe promise of asynchronous php
The promise of asynchronous phpWim Godden
 
Zend con practical-zf1-zf2-migration
Zend con practical-zf1-zf2-migrationZend con practical-zf1-zf2-migration
Zend con practical-zf1-zf2-migrationClark Everetts
 

Destacado (6)

Sunshine php practical-zf1-zf2-migration
Sunshine php practical-zf1-zf2-migrationSunshine php practical-zf1-zf2-migration
Sunshine php practical-zf1-zf2-migration
 
Moving a high traffic ZF1 Enterprise Application to SF2 - Lessons learned
Moving a high traffic ZF1 Enterprise Application to SF2 - Lessons learnedMoving a high traffic ZF1 Enterprise Application to SF2 - Lessons learned
Moving a high traffic ZF1 Enterprise Application to SF2 - Lessons learned
 
Is your code ready for PHP 7 ?
Is your code ready for PHP 7 ?Is your code ready for PHP 7 ?
Is your code ready for PHP 7 ?
 
The promise of asynchronous php
The promise of asynchronous phpThe promise of asynchronous php
The promise of asynchronous php
 
Educação física e inglês (partes do corpo)
Educação física e inglês (partes do corpo)Educação física e inglês (partes do corpo)
Educação física e inglês (partes do corpo)
 
Zend con practical-zf1-zf2-migration
Zend con practical-zf1-zf2-migrationZend con practical-zf1-zf2-migration
Zend con practical-zf1-zf2-migration
 

Similar a Введение в REST API

REST with Eve and Python
REST with Eve and PythonREST with Eve and Python
REST with Eve and PythonPiXeL16
 
Legacy applications - 4Developes konferencja, Piotr Pasich
Legacy applications  - 4Developes konferencja, Piotr PasichLegacy applications  - 4Developes konferencja, Piotr Pasich
Legacy applications - 4Developes konferencja, Piotr PasichPiotr Pasich
 
YAPC::Brasil 2009, POE
YAPC::Brasil 2009, POEYAPC::Brasil 2009, POE
YAPC::Brasil 2009, POEThiago Rondon
 
Diseño y Desarrollo de APIs
Diseño y Desarrollo de APIsDiseño y Desarrollo de APIs
Diseño y Desarrollo de APIsRaúl Neis
 
Introduction to AngularJS
Introduction to AngularJSIntroduction to AngularJS
Introduction to AngularJSPat Cito
 
APIdays Zurich 2019 - Specification Driven Development for REST APIS Alexande...
APIdays Zurich 2019 - Specification Driven Development for REST APIS Alexande...APIdays Zurich 2019 - Specification Driven Development for REST APIS Alexande...
APIdays Zurich 2019 - Specification Driven Development for REST APIS Alexande...apidays
 
APIdays Helsinki 2019 - Specification-Driven Development of REST APIs with Al...
APIdays Helsinki 2019 - Specification-Driven Development of REST APIs with Al...APIdays Helsinki 2019 - Specification-Driven Development of REST APIs with Al...
APIdays Helsinki 2019 - Specification-Driven Development of REST APIs with Al...apidays
 
Apigee Console & eZ Publish REST
Apigee Console & eZ Publish RESTApigee Console & eZ Publish REST
Apigee Console & eZ Publish RESTlserwatka
 
Mojolicious - A new hope
Mojolicious - A new hopeMojolicious - A new hope
Mojolicious - A new hopeMarcus Ramberg
 
Denys Serhiienko "ASGI in depth"
Denys Serhiienko "ASGI in depth"Denys Serhiienko "ASGI in depth"
Denys Serhiienko "ASGI in depth"Fwdays
 
Python RESTful webservices with Python: Flask and Django solutions
Python RESTful webservices with Python: Flask and Django solutionsPython RESTful webservices with Python: Flask and Django solutions
Python RESTful webservices with Python: Flask and Django solutionsSolution4Future
 
JSON Fuzzing: New approach to old problems
JSON Fuzzing: New  approach to old problemsJSON Fuzzing: New  approach to old problems
JSON Fuzzing: New approach to old problemstitanlambda
 
Accumulo Summit 2015: Zookeeper, Accumulo, and You [Internals]
Accumulo Summit 2015: Zookeeper, Accumulo, and You [Internals]Accumulo Summit 2015: Zookeeper, Accumulo, and You [Internals]
Accumulo Summit 2015: Zookeeper, Accumulo, and You [Internals]Accumulo Summit
 
Python Code Camp for Professionals 3/4
Python Code Camp for Professionals 3/4Python Code Camp for Professionals 3/4
Python Code Camp for Professionals 3/4DEVCON
 
Asynchronous programming patterns in Perl
Asynchronous programming patterns in PerlAsynchronous programming patterns in Perl
Asynchronous programming patterns in Perldeepfountainconsulting
 

Similar a Введение в REST API (20)

REST with Eve and Python
REST with Eve and PythonREST with Eve and Python
REST with Eve and Python
 
Zabbix Console
Zabbix ConsoleZabbix Console
Zabbix Console
 
Plack at YAPC::NA 2010
Plack at YAPC::NA 2010Plack at YAPC::NA 2010
Plack at YAPC::NA 2010
 
Legacy applications - 4Developes konferencja, Piotr Pasich
Legacy applications  - 4Developes konferencja, Piotr PasichLegacy applications  - 4Developes konferencja, Piotr Pasich
Legacy applications - 4Developes konferencja, Piotr Pasich
 
YAPC::Brasil 2009, POE
YAPC::Brasil 2009, POEYAPC::Brasil 2009, POE
YAPC::Brasil 2009, POE
 
Diseño y Desarrollo de APIs
Diseño y Desarrollo de APIsDiseño y Desarrollo de APIs
Diseño y Desarrollo de APIs
 
JSON and the APInauts
JSON and the APInautsJSON and the APInauts
JSON and the APInauts
 
Introduction to AngularJS
Introduction to AngularJSIntroduction to AngularJS
Introduction to AngularJS
 
APIdays Zurich 2019 - Specification Driven Development for REST APIS Alexande...
APIdays Zurich 2019 - Specification Driven Development for REST APIS Alexande...APIdays Zurich 2019 - Specification Driven Development for REST APIS Alexande...
APIdays Zurich 2019 - Specification Driven Development for REST APIS Alexande...
 
APIdays Helsinki 2019 - Specification-Driven Development of REST APIs with Al...
APIdays Helsinki 2019 - Specification-Driven Development of REST APIs with Al...APIdays Helsinki 2019 - Specification-Driven Development of REST APIs with Al...
APIdays Helsinki 2019 - Specification-Driven Development of REST APIs with Al...
 
Apigee Console & eZ Publish REST
Apigee Console & eZ Publish RESTApigee Console & eZ Publish REST
Apigee Console & eZ Publish REST
 
Mojolicious - A new hope
Mojolicious - A new hopeMojolicious - A new hope
Mojolicious - A new hope
 
Denys Serhiienko "ASGI in depth"
Denys Serhiienko "ASGI in depth"Denys Serhiienko "ASGI in depth"
Denys Serhiienko "ASGI in depth"
 
Plack - LPW 2009
Plack - LPW 2009Plack - LPW 2009
Plack - LPW 2009
 
Mojolicious
MojoliciousMojolicious
Mojolicious
 
Python RESTful webservices with Python: Flask and Django solutions
Python RESTful webservices with Python: Flask and Django solutionsPython RESTful webservices with Python: Flask and Django solutions
Python RESTful webservices with Python: Flask and Django solutions
 
JSON Fuzzing: New approach to old problems
JSON Fuzzing: New  approach to old problemsJSON Fuzzing: New  approach to old problems
JSON Fuzzing: New approach to old problems
 
Accumulo Summit 2015: Zookeeper, Accumulo, and You [Internals]
Accumulo Summit 2015: Zookeeper, Accumulo, and You [Internals]Accumulo Summit 2015: Zookeeper, Accumulo, and You [Internals]
Accumulo Summit 2015: Zookeeper, Accumulo, and You [Internals]
 
Python Code Camp for Professionals 3/4
Python Code Camp for Professionals 3/4Python Code Camp for Professionals 3/4
Python Code Camp for Professionals 3/4
 
Asynchronous programming patterns in Perl
Asynchronous programming patterns in PerlAsynchronous programming patterns in Perl
Asynchronous programming patterns in Perl
 

Más de Oleg Zinchenko

Keep It Simple Security (Symfony cafe 28-01-2016)
Keep It Simple Security (Symfony cafe 28-01-2016)Keep It Simple Security (Symfony cafe 28-01-2016)
Keep It Simple Security (Symfony cafe 28-01-2016)Oleg Zinchenko
 
Erlang/N2O at KNPMeetup 2015
Erlang/N2O at KNPMeetup 2015Erlang/N2O at KNPMeetup 2015
Erlang/N2O at KNPMeetup 2015Oleg Zinchenko
 
DDD on example of Symfony (SfCampUA14)
DDD on example of Symfony (SfCampUA14)DDD on example of Symfony (SfCampUA14)
DDD on example of Symfony (SfCampUA14)Oleg Zinchenko
 
DDD on example of Symfony (Webcamp Odessa 2014)
DDD on example of Symfony (Webcamp Odessa 2014)DDD on example of Symfony (Webcamp Odessa 2014)
DDD on example of Symfony (Webcamp Odessa 2014)Oleg Zinchenko
 
PHP. Trends, implementations, frameworks and solutions
PHP. Trends, implementations, frameworks and solutionsPHP. Trends, implementations, frameworks and solutions
PHP. Trends, implementations, frameworks and solutionsOleg Zinchenko
 

Más de Oleg Zinchenko (8)

Oro meetup #4
Oro meetup #4Oro meetup #4
Oro meetup #4
 
Keep It Simple Security (Symfony cafe 28-01-2016)
Keep It Simple Security (Symfony cafe 28-01-2016)Keep It Simple Security (Symfony cafe 28-01-2016)
Keep It Simple Security (Symfony cafe 28-01-2016)
 
Erlang (GeekTalks)
Erlang (GeekTalks)Erlang (GeekTalks)
Erlang (GeekTalks)
 
Welcome to Erlang
Welcome to ErlangWelcome to Erlang
Welcome to Erlang
 
Erlang/N2O at KNPMeetup 2015
Erlang/N2O at KNPMeetup 2015Erlang/N2O at KNPMeetup 2015
Erlang/N2O at KNPMeetup 2015
 
DDD on example of Symfony (SfCampUA14)
DDD on example of Symfony (SfCampUA14)DDD on example of Symfony (SfCampUA14)
DDD on example of Symfony (SfCampUA14)
 
DDD on example of Symfony (Webcamp Odessa 2014)
DDD on example of Symfony (Webcamp Odessa 2014)DDD on example of Symfony (Webcamp Odessa 2014)
DDD on example of Symfony (Webcamp Odessa 2014)
 
PHP. Trends, implementations, frameworks and solutions
PHP. Trends, implementations, frameworks and solutionsPHP. Trends, implementations, frameworks and solutions
PHP. Trends, implementations, frameworks and solutions
 

Último

A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?Antenna Manufacturer Coco
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUK Journal
 

Último (20)

A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 

Введение в REST API

  • 1. Введение в REST API Подходы к генерации API документации Oleg Zinchenko oleg@exercise.com
  • 2. О себе Symfony разработчик с 2009 года TeamLead в Exercise.com Продвигаю Symfony2 в массы https://twitter.com/1cdecoder https://github.com/cystbear http://cystbear.tumblr.com/
  • 3. Exercise.com Программы Видео Питание Советы тренера Упражнения Френды, лайки Oleg Zinchenko
  • 4. REST REpresentational State Transfer Передача состояний Over HTTP State-less Кеширование Oleg Zinchenko
  • 5. REST ACTIONS (HTTP METHODS) GET POST PUT/PATCH DELETE Oleg Zinchenko
  • 6. REST RESTful web API GET /api/v1/orders POST /api/v1/orders GET /api/v1/orders/12 PUT /api/v1/orders/12 DELETE /api/v1/orders/12 GET /api/v1/orders/12/delete forbidden Oleg Zinchenko
  • 7. Задача Oleg Zinchenko
  • 8. Задача { "firstName": "Иван", "lastName": "Иванов", "address": { "streetAddress": "Московское ш., 101, кв.101", "city": "Ленинград", "postalCode": 101101 }, "phoneNumbers": [ "812 123-1234", "916 123-4567"] } <person> <firstName>Иван</firstName> <lastName>Иванов</lastName> <address> <streetAddress>Московское ш., 101, кв.101</streetAddress> <city>Ленинград</city> <postalCode>101101</postalCode> </address> <phoneNumbers> <phoneNumber>812 123-1234</phoneNumber> <phoneNumber>916 123-4567</phoneNumber> </phoneNumbers> </person> Oleg Zinchenko
  • 9. Bundles FOSRestBundle FOSRest JMSSerializerBundle jms/metadata Oleg Zinchenko
  • 10. 2 Kernels AppKernel ApiKernel Разный набор конфигов Разный набор бандлов Oleg Zinchenko
  • 11. authentication + authorization authentication + authorization Oleg Zinchenko
  • 12. Authentication http://www.xml.com/pub/a/2003/12/17/dive.html Oleg Zinchenko
  • 13. Serialization Serializer map DemoAcmeDocumentFood: exclusion_policy: ALL properties: calories: expose: true caloriesPerServing: expose: true caloriesPerGram: expose: true caloriesPerFluidOunce: expose: true measurement: expose: true servingOptions: expose: true callback_methods: pre_serialize: [prepareMeasurement, prepareServingOptions] Oleg Zinchenko
  • 14. Serialization Object Handlers { "id": "4fb1fb87944c4c0e240004de", "slug": "minimalist-article", "title": "Minimalist article", "updated_at": "2012-05-15T09:45:26+0300", "summary": "Minimalist summary", "body": "Minimalist body", "main_image": "http://e.com/upl/art/thum/parrot.mobile_client_medium.v1.jpg" } Oleg Zinchenko
  • 15. Тестирование Behat Buzz + aka WebApiContext Scenario: /foods get list of food. Pagination supported. Given I authorized as: "fred" When I make "GET" request to the "/api/v1/foods" Then the response status code should be: "200" And the response body should be similar to JSON: """ [{"id":"4fb1fb8f944c4c0e24000622","slug":"bittermelon-cooked-a… }] """ Oleg Zinchenko
  • 18. Документация Swagger apis: [{ path: "/pet.{format}/{petId}", description: "Operations about pets", operations: [{ httpMethod: "GET", nickname: "getPetById", responseClass: "Pet", parameters: [...] summary: "Find pet by its unique ID" notes: "Only Pets which you have permission to see will be returned", errorResponses: [...] }] } http://swagger.wordnik.com/ Oleg Zinchenko
  • 20. Документация NelmioApiDocBundle /** * This the documentation description of your method, it will appear * on a specific pane. It will read all the text until the first * annotation. * * @ApiDoc( * resource=true, * description="This is a description of your API method", * filters={ * {"name"="a-filter", "dataType"="integer"}, * {"name"="another-filter", "dataType"="string", "pattern"="(foo|bar) ASC|DESC"} * } * ) */ public function getAction() { } https://github.com/nelmio/NelmioApiDocBundle Oleg Zinchenko
  • 22. Спасибо Вопросы? Oleg Zinchenko