Upgrade to Pro — share decks privately, control downloads, hide ads and more …

APIs do Jeito Certo

Sponsored · Your Podcast. Everywhere. Effortlessly. Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
Avatar for Er Galvão Abbott Er Galvão Abbott
December 13, 2024
270

APIs do Jeito Certo

Um apanhado geral sobre APIs, incluindo Design-first, OAS, Restful e instrumental.

Avatar for Er Galvão Abbott

Er Galvão Abbott

December 13, 2024
Tweet

Transcript

  1. CC Attribution-ShareAlike 3.0 Unported License by Er Galvão Abbott -

    12/13/24 - 1 / 81 galvao.eti.br v 1.2.0 - 2024-12-07 APIs do jeito certo
  2. Atua há 30 anos no Mercado de TI: Programador (>

    25), Professor / Palestrante (> 20) e Consultor (> 25) Engenheiro de Software Sênior / Tech Lead Professor Convidado (Especialista) de Pós-Graduação (PR e SC) Diretor, ConFLOSS, NodeConBR e PHP Conference Brasil Evangelista e Contribuidor para a Linguagem PHP Evangelista e Contribuidor para o Laminas Project Primeiro Brasileiro a se tornar Postman Supernova Presidente da ABRAPHP – Associação Brasileira de Profissionais PHP Apaixonado por Backend, APIs, Qualidade, Segurança e Software Livre galvao.eti.br galvao.eti.br Meu nome é Galvão CC Attribution-ShareAlike 3.0 Unported License by Er Galvão Abbott - 12/13/2024 – v0.2.0 – Slide 2 / 81
  3. galvao.eti.br Objetivo CC Attribution-ShareAlike 3.0 Unported License by Er Galvão

    Abbott - 12/13/24 - 3 / 81 Apresentar um apanhado geral sobre APIs, incluindo: • Design-First • OpenAPI Specification • Ciclo de desenvolvimento • ReST(ful) • e instrumental.
  4. APIs FTW! galvao.eti.br CC Attribution-ShareAlike 3.0 Unported License by Er

    Galvão Abbott - 12/13/24 - 6 / 81 APIs? strlen( string $str ) → int
  5. APIs FTW! galvao.eti.br CC Attribution-ShareAlike 3.0 Unported License by Er

    Galvão Abbott - 12/13/24 - 7 / 81 APIs? strlen( string $str ) → int ponto de acesso
  6. APIs FTW! galvao.eti.br CC Attribution-ShareAlike 3.0 Unported License by Er

    Galvão Abbott - 12/13/24 - 8 / 81 APIs? strlen( string $str ) → int ponto de acesso informação
  7. APIs FTW! galvao.eti.br CC Attribution-ShareAlike 3.0 Unported License by Er

    Galvão Abbott - 12/13/24 - 9 / 81 APIs? strlen( string $str ) → int ponto de acesso informação resultado
  8. APIs FTW! galvao.eti.br CC Attribution-ShareAlike 3.0 Unported License by Er

    Galvão Abbott - 12/13/24 - 10 / 81 APIs? strlen( string $str ) → int https://whatevers/product/1109 → {...}
  9. APIs FTW! galvao.eti.br CC Attribution-ShareAlike 3.0 Unported License by Er

    Galvão Abbott - 12/13/24 - 11 / 81 APIs? strlen( string $str ) → int https://whatevers/product/1109 → {...} ponto de acesso
  10. APIs FTW! galvao.eti.br CC Attribution-ShareAlike 3.0 Unported License by Er

    Galvão Abbott - 12/13/24 - 12 / 81 APIs? strlen( string $str ) → int https://whatevers/product/1109 → {...} ponto de acesso informação
  11. APIs FTW! galvao.eti.br CC Attribution-ShareAlike 3.0 Unported License by Er

    Galvão Abbott - 12/13/24 - 13 / 81 APIs? strlen( string $str ) → int https://whatevers/product/1109 → {...} ponto de acesso informação resultado
  12. Por que toda a aplicação deveria ser desenvolvida como uma

    API? galvao.eti.br Por que APIs CC Attribution-ShareAlike 3.0 Unported License by Er Galvão Abbott - 12/13/24 - 14 / 81
  13. Por que toda a aplicação deveria ser desenvolvida como uma

    API? galvao.eti.br CC Attribution-ShareAlike 3.0 Unported License by Er Galvão Abbott - 12/13/24 - 15 / 81 Por que APIs
  14. Por que toda a aplicação deveria ser desenvolvida como uma

    API? galvao.eti.br CC Attribution-ShareAlike 3.0 Unported License by Er Galvão Abbott - 12/13/24 - 16 / 81 Por que APIs + Verdadeira Separação entre Back e Front
  15. Por que toda a aplicação deveria ser desenvolvida como uma

    API? galvao.eti.br CC Attribution-ShareAlike 3.0 Unported License by Er Galvão Abbott - 12/13/24 - 17 / 81 Por que APIs + Verdadeira Separação entre Back e Front + Agnosticismo de linguagens
  16. Por que toda a aplicação deveria ser desenvolvida como uma

    API? galvao.eti.br CC Attribution-ShareAlike 3.0 Unported License by Er Galvão Abbott - 12/13/24 - 18 / 81 Por que APIs + Verdadeira Separação entre Back e Front + Agnosticismo de linguagens + Otimização de Performance de backend
  17. Por que toda a aplicação deveria ser desenvolvida como uma

    API? galvao.eti.br CC Attribution-ShareAlike 3.0 Unported License by Er Galvão Abbott - 12/13/24 - 19 / 81 Por que APIs + Verdadeira Separação entre Back e Front + Agnosticismo de linguagens + Otimização de Performance de backend + Um back*, múltiplos fronts
  18. Por que toda a aplicação deveria ser desenvolvida como uma

    API? galvao.eti.br CC Attribution-ShareAlike 3.0 Unported License by Er Galvão Abbott - 12/13/24 - 20 / 81 Por que APIs + Verdadeira Separação entre Back e Front + Agnosticismo de linguagens + Otimização de Performance de backend + Um back*, múltiplos fronts + Escalabilidade*
  19. Por que toda a aplicação deveria ser desenvolvida como uma

    API? galvao.eti.br CC Attribution-ShareAlike 3.0 Unported License by Er Galvão Abbott - 12/13/24 - 21 / 81 Por que APIs + Verdadeira Separação entre Back e Front + Agnosticismo de linguagens + Otimização de Performance de backend + Um back*, múltiplos fronts + Escalabilidade* * Ou, até mesmo, múltiplos backs e fronts
  20. Por que Design-First? galvao.eti.br Por que Design-First? CC Attribution-ShareAlike 3.0

    Unported License by Er Galvão Abbott - 12/13/24 - 22 / 81
  21. galvao.eti.br CC Attribution-ShareAlike 3.0 Unported License by Er Galvão Abbott

    - 12/13/24 - 31 / 81 Por que Design-First? openapis.org
  22. galvao.eti.br CC Attribution-ShareAlike 3.0 Unported License by Er Galvão Abbott

    - 12/13/24 - 32 / 81 Por que Design-First? ... paths openapis.org
  23. galvao.eti.br CC Attribution-ShareAlike 3.0 Unported License by Er Galvão Abbott

    - 12/13/24 - 33 / 81 Por que Design-First? ... paths + components openapis.org
  24. galvao.eti.br CC Attribution-ShareAlike 3.0 Unported License by Er Galvão Abbott

    - 12/13/24 - 34 / 81 Por que Design-First? ... paths + components + $ref ... openapis.org
  25. galvao.eti.br CC Attribution-ShareAlike 3.0 Unported License by Er Galvão Abbott

    - 12/13/24 - 36 / 81 Por que Design-First? Zero Code
  26. galvao.eti.br CC Attribution-ShareAlike 3.0 Unported License by Er Galvão Abbott

    - 12/13/24 - 37 / 81 Por que Design-First? Zero Code Code
  27. galvao.eti.br CC Attribution-ShareAlike 3.0 Unported License by Er Galvão Abbott

    - 12/13/24 - 41 / 81 + Client-Server + Stateless - não existe persistência de estado Por que ReST?
  28. galvao.eti.br CC Attribution-ShareAlike 3.0 Unported License by Er Galvão Abbott

    - 12/13/24 - 42 / 81 + Client-Server + Stateless - não existe persistência de estado + Cache - Declaração explícita se a resposta é cacheável Por que ReST?
  29. galvao.eti.br CC Attribution-ShareAlike 3.0 Unported License by Er Galvão Abbott

    - 12/13/24 - 43 / 81 + Client-Server + Stateless - não existe persistência de estado + Cache - Declaração explícita se a resposta é cacheável + Uniformidade de Interface Por que ReST?
  30. galvao.eti.br CC Attribution-ShareAlike 3.0 Unported License by Er Galvão Abbott

    - 12/13/24 - 44 / 81 + Client-Server + Stateless - não existe persistência de estado + Cache - Declaração explícita se a resposta é cacheável + Uniformidade de Interface + Camadas - Impossibilidade de determinar “tipo” de conexão Por que ReST?
  31. galvao.eti.br CC Attribution-ShareAlike 3.0 Unported License by Er Galvão Abbott

    - 12/13/24 - 45 / 81 … e, além disso... … e, além disso...
  32. galvao.eti.br CC Attribution-ShareAlike 3.0 Unported License by Er Galvão Abbott

    - 12/13/24 - 46 / 81 … e, além disso... SQL HTTP(S) C R U D
  33. galvao.eti.br CC Attribution-ShareAlike 3.0 Unported License by Er Galvão Abbott

    - 12/13/24 - 47 / 81 … e, além disso... SQL HTTP(S) Create Retrieve Update Delete
  34. galvao.eti.br CC Attribution-ShareAlike 3.0 Unported License by Er Galvão Abbott

    - 12/13/24 - 48 / 81 … e, além disso... INSERT SQL HTTP(S) Create Retrieve Update Delete
  35. galvao.eti.br CC Attribution-ShareAlike 3.0 Unported License by Er Galvão Abbott

    - 12/13/24 - 49 / 81 … e, além disso... INSERT SQL HTTP(S) Create Retrieve Update Delete POST
  36. galvao.eti.br CC Attribution-ShareAlike 3.0 Unported License by Er Galvão Abbott

    - 12/13/24 - 50 / 81 … e, além disso... INSERT SELECT SQL HTTP(S) Create Retrieve Update Delete POST
  37. galvao.eti.br CC Attribution-ShareAlike 3.0 Unported License by Er Galvão Abbott

    - 12/13/24 - 51 / 81 … e, além disso... INSERT SELECT SQL HTTP(S) Create Retrieve Update Delete POST GET
  38. galvao.eti.br CC Attribution-ShareAlike 3.0 Unported License by Er Galvão Abbott

    - 12/13/24 - 52 / 81 … e, além disso... INSERT SELECT UPDATE SQL HTTP(S) Create Retrieve Update Delete POST GET
  39. galvao.eti.br CC Attribution-ShareAlike 3.0 Unported License by Er Galvão Abbott

    - 12/13/24 - 53 / 81 … e, além disso... INSERT SELECT UPDATE SQL HTTP(S) Create Retrieve Update Delete POST GET PATCH / PUT
  40. galvao.eti.br CC Attribution-ShareAlike 3.0 Unported License by Er Galvão Abbott

    - 12/13/24 - 54 / 81 … e, além disso... INSERT SELECT UPDATE DELETE SQL HTTP(S) Create Retrieve Update Delete POST GET PATCH / PUT
  41. galvao.eti.br CC Attribution-ShareAlike 3.0 Unported License by Er Galvão Abbott

    - 12/13/24 - 55 / 81 … e, além disso... INSERT SELECT UPDATE DELETE SQL HTTP(S) Create Retrieve Update Delete POST GET PATCH / PUT DELETE
  42. galvao.eti.br CC Attribution-ShareAlike 3.0 Unported License by Er Galvão Abbott

    - 12/13/24 - 56 / 81 httpstatuses.com … e, além disso... ‘bora falar de status HTTP?
  43. galvao.eti.br CC Attribution-ShareAlike 3.0 Unported License by Er Galvão Abbott

    - 12/13/24 - 57 / 81 httpstatuses.com … e, além disso... Sim, precisamos falar de status HTTP...
  44. galvao.eti.br CC Attribution-ShareAlike 3.0 Unported License by Er Galvão Abbott

    - 12/13/24 - 58 / 81 httpstatuses.com Mais … e, além disso...
  45. galvao.eti.br CC Attribution-ShareAlike 3.0 Unported License by Er Galvão Abbott

    - 12/13/24 - 59 / 81 httpstatuses.com Mais 201, 204, 401, 403, 404, 405, 406, 413, 429... … e, além disso...
  46. galvao.eti.br CC Attribution-ShareAlike 3.0 Unported License by Er Galvão Abbott

    - 12/13/24 - 60 / 81 httpstatuses.com Mais 201, 204, 401, 403, 404, 405, 406, 413, 429... Menos … e, além disso...
  47. galvao.eti.br CC Attribution-ShareAlike 3.0 Unported License by Er Galvão Abbott

    - 12/13/24 - 61 / 81 httpstatuses.com Mais 201, 204, 401, 403, 404, 405, 406, 413, 429... Menos 200, 400. … e, além disso...
  48. galvao.eti.br CC Attribution-ShareAlike 3.0 Unported License by Er Galvão Abbott

    - 12/13/24 - 62 / 81 httpstatuses.com Mais 201, 204, 401, 403, 404, 405, 406, 413, 429... Menos 200, 400. Nunca* … e, além disso...
  49. galvao.eti.br CC Attribution-ShareAlike 3.0 Unported License by Er Galvão Abbott

    - 12/13/24 - 63 / 81 httpstatuses.com Mais 201, 204, 401, 403, 404, 405, 406, 413, 429... Menos 200, 400. Nunca* 5xx. … e, além disso...
  50. galvao.eti.br CC Attribution-ShareAlike 3.0 Unported License by Er Galvão Abbott

    - 12/13/24 - 64 / 81 Create Retrieve Update Delete INSERT SELECT UPDATE DELETE POST GET PATCH / PUT DELETE SQL HTTP(S) Response … e, além disso...
  51. galvao.eti.br CC Attribution-ShareAlike 3.0 Unported License by Er Galvão Abbott

    - 12/13/24 - 65 / 81 Create Retrieve Update Delete INSERT SELECT UPDATE DELETE POST GET PATCH / PUT DELETE SQL HTTP(S) Response 201 … e, além disso...
  52. galvao.eti.br CC Attribution-ShareAlike 3.0 Unported License by Er Galvão Abbott

    - 12/13/24 - 66 / 81 Create Retrieve Update Delete INSERT SELECT UPDATE DELETE POST GET PATCH / PUT DELETE SQL HTTP(S) Response 201 200 … e, além disso...
  53. galvao.eti.br CC Attribution-ShareAlike 3.0 Unported License by Er Galvão Abbott

    - 12/13/24 - 67 / 81 Create Retrieve Update Delete INSERT SELECT UPDATE DELETE POST GET PATCH / PUT DELETE SQL HTTP(S) Response 201 200 204 … e, além disso...
  54. galvao.eti.br CC Attribution-ShareAlike 3.0 Unported License by Er Galvão Abbott

    - 12/13/24 - 68 / 81 Create Retrieve Update Delete INSERT SELECT UPDATE DELETE POST GET PATCH / PUT DELETE SQL HTTP(S) Response 201 200 204 204 … e, além disso...
  55. galvao.eti.br CC Attribution-ShareAlike 3.0 Unported License by Er Galvão Abbott

    - 12/13/24 - 70 / 81 • Documentation • Linting • Mocking • Proxying • Testing FERRAMENTAS!
  56. galvao.eti.br CC Attribution-ShareAlike 3.0 Unported License by Er Galvão Abbott

    - 12/13/24 - 71 / 81 LINTING spectral - stoplight.io/open-source/spectral Postman - postman.com
  57. galvao.eti.br CC Attribution-ShareAlike 3.0 Unported License by Er Galvão Abbott

    - 12/13/24 - 72 / 81 MOCKING prism - stoplight.io/open-source/prism Postman - postman.com
  58. galvao.eti.br CC Attribution-ShareAlike 3.0 Unported License by Er Galvão Abbott

    - 12/13/24 - 73 / 81 DOCUMENTATION elements - stoplight.io/open-source/elements redoc-cli - yarnpkg.com/package/redoc-cli Postman - postman.com
  59. galvao.eti.br CC Attribution-ShareAlike 3.0 Unported License by Er Galvão Abbott

    - 12/13/24 - 74 / 81 PROXYING prism - stoplight.io/open-source/prism Postman - postman.com
  60. galvao.eti.br CC Attribution-ShareAlike 3.0 Unported License by Er Galvão Abbott

    - 12/13/24 - 75 / 81 TESTING httpie.io http-prompt - github.com/httpie/http-prompt Postman - postman.com usebruno.com terminaltrove.com/atac
  61. galvao.eti.br CC Attribution-ShareAlike 3.0 Unported License by Er Galvão Abbott

    - 12/13/24 - 78 / 81 http-prompt Performance Testes Rápidos Pipeline
  62. galvao.eti.br CC Attribution-ShareAlike 3.0 Unported License by Er Galvão Abbott

    - 12/13/24 - 79 / 81 “Tudo-em-um” Gerência de grandes APIs Replayability Features que são melhores em aplicações GUI E mais...
  63. galvao.eti.br Muito Obrigado! CC Attribution-ShareAlike 3.0 Unported License by Er

    Galvão Abbott - 12/13/24 - 81 / 81 Dúvidas, Críticas, Elogios, etc…? ‘bora conversar!