Successfully reported this slideshow.
Your SlideShare is downloading. ×

Symfony ile Gelişmiş API Mimarisi

Ad
Ad
Ad
Ad
Ad
Ad
Ad
Ad
Ad
Ad
Ad
Loading in …3
×

Check these out next

1 of 22 Ad
Advertisement

More Related Content

Slideshows for you (20)

Similar to Symfony ile Gelişmiş API Mimarisi (20)

Advertisement

Symfony ile Gelişmiş API Mimarisi

  1. 1. Symfony ile Gelişmiş API Mimarisi
  2. 2. Behram ÇELEN Software Developer github.com/behramcelen twitter.com/behramcelen behramcelen@gmail.com
  3. 3. API ● Application Programming Interface ● REST ● Facebook/Twitter.. API ● Postman ● Swagger ● RESTful API ● JSON and XML ● Versioning
  4. 4. Symfony Bundles ● FOSRestBundle ● NelmioApiDocBundle https://github.com/FriendsOfSymfony/FOSRestBundle https://github.com/nelmio/NelmioApiDocBundle
  5. 5. API Methods ● GET ● POST ● PUT ● PATCH ● DELETE https://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html
  6. 6. GET ● Değişikliğe neden olmamalı ● Cache Kullanılabilir ● Resource veya Resource Collection dönmeli ● Offset ve Limit olmalı (Collection için) https://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html#sec9.3
  7. 7. POST ● Resource create ● Validation ● Hata veya resource location dönmeli https://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html#sec9.5
  8. 8. PUT ● Create resource if not exists ● Validation ● Eğer resource varsa güncellemeli ● Yoksa resource u oluşturmalı https://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html#sec9.6
  9. 9. PATCH ● Resource yoksa 404 dönmeli ● Validation ● Resource un belirli fieldları güncellenebilir https://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html#sec9.6
  10. 10. DELETE ● Resource yoksa 404 dönmeli ● Resource varsa silinmeli ● NULL content dönmeli https://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html#sec9.7
  11. 11. FOSRestBundle ● Kurulum ● JMSSerializerBundle ● Handlers ● Routing http://symfony.com/doc/master/bundles/FOSRestBundle/1- setting_up_the_bundle.html http://jmsyst.com/libs/serializer https://github.com/ojs/ojs/tree/master/src/Ojs/ApiBundle/Handler https://github. com/ojs/ojs/blob/master/src/Ojs/ApiBundle/Resources/config/routing_ rest.yml
  12. 12. NelmioApiDoc Bundle ● Swagger Doc Support ● View Layer ● Annotation ● Commands ● HTML, Markdown, JSON do dump ● Sandbox Support https://github. com/nelmio/NelmioApiDocBundle/blob/master/Resources/doc/index. rst https://github. com/ojs/ojs/blob/master/src/Ojs/ApiBundle/Controller/Journal/Journal ArticleAuthorRestController.php#L150
  13. 13. Routing https://github.com/ojs/ojs/blob/master/app%2Fconfig%2Frouting_rest.yml https://github.com/ojs/ojs/blob/master/src%2FOjs%2FApiBundle%2FResources%2Fconfig%2Frouting_rest.yml
  14. 14. Security ● ACL ● ApiKey Auth
  15. 15. Related Links https://github.com/ojs/ojs/blob/master/app/config/security.yml#L20 https://github.com/ojs/ojs/blob/a8f11d6b7fd351a837a21ece92f487a3ca978d71/app/config/services.yml#L14 https://github.com/ojs/ojs/blob/master/src/Ojs/ApiBundle/Security/ApiKeyUserProvider.php#L20 https://github.com/ojs/ojs/blob/master/src%2FOjs%2FApiBundle%2FSecurity%2FApiKeyAuthenticator.php#L16 https://github.com/ojs/ojs/blob/master/src%2FOjs%2FApiBundle%2FController%2FAdmin%2FArticleTypeRestController.php#L44
  16. 16. Handlers https://github.com/ojs/ojs/blob/master/src%2FOjs%2FApiBundle%2FResources%2Fconfig%2Fservices.yml https://github.com/ojs/ojs/blob/master/src%2FOjs%2FApiBundle%2FHandler%2FArticleTypeHandler.php https://github.com/ojs/ojs/blob/master/src%2FOjs%2FApiBundle%2FController%2FAdmin%2FArticleTypeRestController.php#L129
  17. 17. Exception https://github.com/ojs/ojs/blob/master/src%2FOjs%2FApiBundle%2FException%2FInvalidFormException.php https://github.com/ojs/ojs/blob/master/src%2FOjs%2FApiBundle%2FController%2FAdmin%2FArticleTypeRestController.php#L45 https://github.com/ojs/ojs/blob/master/src%2FOjs%2FApiBundle%2FController%2FAdmin%2FArticleTypeRestController.php#L277 https://github.com/ojs/ojs/blob/master/src%2FOjs%2FApiBundle%2FSecurity%2FApiKeyAuthenticator.php#L31
  18. 18. Validation https://github.com/ojs/ojs/blob/master/src%2FOjs%2FApiBundle%2FHandler%2FArticleTypeHandler.php#L119 https://github.com/ojs/ojs/blob/master/src%2FOjs%2FAdminBundle%2FForm%2FType%2FArticleTypesType.php https://github.com/ojs/ojs/blob/master/src%2FOjs%2FJournalBundle%2FResources%2Fconfig%2Fvalidation%2FJournal.yml
  19. 19. Serializer http://jmsyst.com/libs/serializer http://jmsyst.com/libs/serializer/master/reference/annotations https://github.com/ojs/ojs/blob/master/src%2FOjs%2FJournalBundle%2FEntity%2FArticle.php#L26
  20. 20. Tests https://github.com/ojs/ojs/tree/master/src/Ojs/ApiBundle/Tests/Controller
  21. 21. File Upload https://github.com/ojs/ojs/blob/master/src%2FOjs%2FApiBundle%2FTests%2FController%2FJournalIssueRestControllerTest. php#L25 https://github.com/ojs/ojs/blob/master/src%2FOjs%2FApiBundle%2FHandler%2FJournalIssueHandler.php#L162
  22. 22. Teşekkürler behramcelen@gmail.com

×