SlideShare una empresa de Scribd logo
1 de 19
Descargar para leer sin conexión
Globalcode – Open4education
JSON API: não reinvente a roda
Pedro Cavalheiro
Trilha Web
Globalcode – Open4education
Pedro Cavalheiro
Desenvolvedor web há 6 anos, em sua
maioria trabalhando com Ruby e PHP.
Entusiasta por tecnologia como um todo,
adora estudar novas ferramentas,
linguagens e metodologias.
Atualmente no Me Salva!.
Infos em pecavalheiro.com
Globalcode – Open4education
Did I hear API?
Globalcode – Open4education
API
• Application Programming Interface
• Web Services (HTTP)
• SOAP
• REST
• JSON
Globalcode – Open4education
REST API
• O que é importante?
• Segurança/Autenticação
• Documentação
• Requisitos/Complexidade
• Design de requisições/respostas
• +
Globalcode – Open4education
Globalcode – Open4education
bikeshed (noun)
• (literally) An enclosed structure where bicycles
may be stored.
• (figuratively, technical jargon) A topic that is
attracting debate ad nauseam, out of all proportion
to its actual importance. Also bikeshedding, the
process of futile investment of time and energy in
discussion of marginal technical issues.
Globalcode – Open4education
Globalcode – Open4education
Did I hear API?
Globalcode – Open4education
Did I hear API?
Globalcode – Open4education
JSON API
• O que ele define?
Just kidding!
Globalcode – Open4education
• Como um cliente deve consultar, criar e/ou modificar
recursos.
• Verbos
• Formato da URL/Filtros
• Paginação
• +
• Como o servidor deve responder a estas requisições.
• Estrutura de resposta
• Status Code
• +
JSON API
• O que ele define?
Globalcode – Open4education
HTTP/1.1 200 OK
Content-Type: application/vnd.api+json
{
"data": [{
"type": "articles",
"id": "1",
"attributes": {
"title": "JSON API paints my bikeshed!",
"body": "The shortest article. Ever.",
"created": "2015-05-22T14:56:29.000Z",
"updated": "2015-05-22T14:56:28.000Z"
},
"relationships": {
"author": {
"data": {"id": "42", "type": "people"}
}
}
}],
"included": [
{
"type": "people",
"id": "42",
"attributes": {
"name": "John",
"age": 80,
"gender": "male"
}
}
]
}
GET /articles?include=author HTTP/1.1
Globalcode – Open4education
HTTP/1.1 200 OK
Content-Type: application/vnd.api+json
{
"meta": {
"total-pages": 13
},
"data": [
{
"type": "articles",
"id": "3",
"attributes": {
"title": "JSON API paints my bikeshed!",
"body": "The shortest article. Ever.",
"created": "2015-05-22T14:56:29.000Z",
"updated": "2015-05-22T14:56:28.000Z"
}
}
],
"links": {
"self": "http://example.com/articles?page[number]=3&page[size]=1",
"first": "http://example.com/articles?page[number]=1&page[size]=1",
"prev": "http://example.com/articles?page[number]=2&page[size]=1",
"next": "http://example.com/articles?page[number]=4&page[size]=1",
"last": "http://example.com/articles?page[number]=13&page[size]=1"
}
}
GET /articles?page[number]=3&page[size]=1 HTTP/1.1
Globalcode – Open4education
HTTP/1.1 422 Unprocessable Entity
Content-Type: application/vnd.api+json
{
"errors": [
{
"status": "422",
"source": { "pointer": "/data/attributes/first-name" },
"title": "Invalid Attribute",
"detail": "First name must contain at least three characters."
}
]
}
Globalcode – Open4education
JSON API
• Implementação
Globalcode – Open4education
• Client libraries
• JavaScript, iOS, Ruby, PHP, Dart, Perl, Java, Android, R, Elm, .NET
• Server libraries
• PHP, Node.js, Ruby, Python, Go, .NET, Java, Scala, Elixir, Haskell,
Perl, Vala
JSON API
• Implementação - jsonapi.org/implementations
Globalcode – Open4education
Resumão
• Calma! Ajuste uma parte de cada vez
• JSON API não é “lei”, existem outros padrões:
HAL, Siren, JSON-LD, Collection+JSON, etc
• Adote padrões, eles facilitam nossa vida :)
Globalcode – Open4education
Dúvidas?
jsonapi.org
pecavalheiro.com
OBRIGADO!

Más contenido relacionado

Destacado

Destacado (20)

Backup & Restore SharePoint 2013 Farm
Backup & Restore SharePoint 2013 FarmBackup & Restore SharePoint 2013 Farm
Backup & Restore SharePoint 2013 Farm
 
TDC 2016 SP - 5 libs de teste JavaScript que você deveria conhecer
TDC 2016 SP - 5 libs de teste JavaScript que você deveria conhecerTDC 2016 SP - 5 libs de teste JavaScript que você deveria conhecer
TDC 2016 SP - 5 libs de teste JavaScript que você deveria conhecer
 
Chris O'Brien - Customizing the SharePoint/Office 365 UI with JavaScript (ESP...
Chris O'Brien - Customizing the SharePoint/Office 365 UI with JavaScript (ESP...Chris O'Brien - Customizing the SharePoint/Office 365 UI with JavaScript (ESP...
Chris O'Brien - Customizing the SharePoint/Office 365 UI with JavaScript (ESP...
 
Cool Dashboards and Visualizations for SharePoint Power Users
Cool Dashboards and Visualizations for SharePoint Power UsersCool Dashboards and Visualizations for SharePoint Power Users
Cool Dashboards and Visualizations for SharePoint Power Users
 
2013 SPFest - Customizing Sites and Pages in SharePoint 2013
2013 SPFest - Customizing Sites and Pages in SharePoint 20132013 SPFest - Customizing Sites and Pages in SharePoint 2013
2013 SPFest - Customizing Sites and Pages in SharePoint 2013
 
Les 10 strategies d'adoption de SharePoint 2013
Les 10 strategies d'adoption de SharePoint 2013Les 10 strategies d'adoption de SharePoint 2013
Les 10 strategies d'adoption de SharePoint 2013
 
inext café #03 - Automatiser ses processus métier avec SharePoint et Nintex
inext café #03 - Automatiser ses processus métier avec SharePoint et Nintexinext café #03 - Automatiser ses processus métier avec SharePoint et Nintex
inext café #03 - Automatiser ses processus métier avec SharePoint et Nintex
 
Presentation Backup & Restore SharePoint 2013 Farm
Presentation Backup & Restore SharePoint 2013 FarmPresentation Backup & Restore SharePoint 2013 Farm
Presentation Backup & Restore SharePoint 2013 Farm
 
Build Killer Visuals with SharePoint 2013 Search & Display Templates
Build Killer Visuals with SharePoint 2013 Search & Display TemplatesBuild Killer Visuals with SharePoint 2013 Search & Display Templates
Build Killer Visuals with SharePoint 2013 Search & Display Templates
 
TDC2016POA | Trilha Web - Garanta a segurança de suas aplicações Web com Keyc...
TDC2016POA | Trilha Web - Garanta a segurança de suas aplicações Web com Keyc...TDC2016POA | Trilha Web - Garanta a segurança de suas aplicações Web com Keyc...
TDC2016POA | Trilha Web - Garanta a segurança de suas aplicações Web com Keyc...
 
TDC2016POA | Trilha Web - A essência do CSS
TDC2016POA | Trilha Web - A essência do CSSTDC2016POA | Trilha Web - A essência do CSS
TDC2016POA | Trilha Web - A essência do CSS
 
Agilizando o desenvolvimento web com SASS
Agilizando o desenvolvimento web com SASSAgilizando o desenvolvimento web com SASS
Agilizando o desenvolvimento web com SASS
 
Levando seu app do iOS para o macOS
Levando seu app do iOS para o macOSLevando seu app do iOS para o macOS
Levando seu app do iOS para o macOS
 
Transform SharePoint default list forms with HTML, CSS and JavaScript
Transform SharePoint default list forms with HTML, CSS and JavaScriptTransform SharePoint default list forms with HTML, CSS and JavaScript
Transform SharePoint default list forms with HTML, CSS and JavaScript
 
TDC 2016 - Sass: CSS com super-poderes.
TDC 2016 - Sass: CSS com super-poderes.TDC 2016 - Sass: CSS com super-poderes.
TDC 2016 - Sass: CSS com super-poderes.
 
TDC 2016 - Garantindo a qualidade da sua infraestrutura
TDC 2016 - Garantindo a qualidade da sua infraestruturaTDC 2016 - Garantindo a qualidade da sua infraestrutura
TDC 2016 - Garantindo a qualidade da sua infraestrutura
 
The A to Z of Building a Responsive SharePoint Site with Bootstrap
The A to Z of Building a Responsive SharePoint Site with BootstrapThe A to Z of Building a Responsive SharePoint Site with Bootstrap
The A to Z of Building a Responsive SharePoint Site with Bootstrap
 
TDC POA 2016 - Robotium + Cucumber + Gradle, misture com spoon e tenha uma ex...
TDC POA 2016 - Robotium + Cucumber + Gradle, misture com spoon e tenha uma ex...TDC POA 2016 - Robotium + Cucumber + Gradle, misture com spoon e tenha uma ex...
TDC POA 2016 - Robotium + Cucumber + Gradle, misture com spoon e tenha uma ex...
 
Como ensinei mais de 1000 testadores
Como ensinei mais de 1000 testadoresComo ensinei mais de 1000 testadores
Como ensinei mais de 1000 testadores
 
TDC2016POA | Trilha Web - Realtime applications com Socket.io
TDC2016POA | Trilha Web - Realtime applications com Socket.ioTDC2016POA | Trilha Web - Realtime applications com Socket.io
TDC2016POA | Trilha Web - Realtime applications com Socket.io
 

Similar a TDC2016POA | Trilha Web - JSON API: não reinvente a roda

The liferay case: lessons learned evolving from RPC to Hypermedia REST APIs
The liferay case: lessons learned evolving from RPC to Hypermedia REST APIsThe liferay case: lessons learned evolving from RPC to Hypermedia REST APIs
The liferay case: lessons learned evolving from RPC to Hypermedia REST APIs
Jorge Ferrer
 

Similar a TDC2016POA | Trilha Web - JSON API: não reinvente a roda (20)

JSON API: Não reinvente a roda
JSON API: Não reinvente a rodaJSON API: Não reinvente a roda
JSON API: Não reinvente a roda
 
Building RESTful APIs
Building RESTful APIsBuilding RESTful APIs
Building RESTful APIs
 
JSON REST API for WordPress
JSON REST API for WordPressJSON REST API for WordPress
JSON REST API for WordPress
 
The liferay case: lessons learned evolving from RPC to Hypermedia REST APIs
The liferay case: lessons learned evolving from RPC to Hypermedia REST APIsThe liferay case: lessons learned evolving from RPC to Hypermedia REST APIs
The liferay case: lessons learned evolving from RPC to Hypermedia REST APIs
 
曾勇 Elastic search-intro
曾勇 Elastic search-intro曾勇 Elastic search-intro
曾勇 Elastic search-intro
 
Austin Day of Rest - Introduction
Austin Day of Rest - IntroductionAustin Day of Rest - Introduction
Austin Day of Rest - Introduction
 
JSON REST API for WordPress
JSON REST API for WordPressJSON REST API for WordPress
JSON REST API for WordPress
 
Introduction to PHP - SDPHP
Introduction to PHP - SDPHPIntroduction to PHP - SDPHP
Introduction to PHP - SDPHP
 
Generating Unified APIs with Protocol Buffers and gRPC
Generating Unified APIs with Protocol Buffers and gRPCGenerating Unified APIs with Protocol Buffers and gRPC
Generating Unified APIs with Protocol Buffers and gRPC
 
Elastic search intro-@lamper
Elastic search intro-@lamperElastic search intro-@lamper
Elastic search intro-@lamper
 
Developing Brilliant and Powerful APIs in Ruby & Python
Developing Brilliant and Powerful APIs in Ruby & PythonDeveloping Brilliant and Powerful APIs in Ruby & Python
Developing Brilliant and Powerful APIs in Ruby & Python
 
Building APIs in an easy way using API Platform
Building APIs in an easy way using API PlatformBuilding APIs in an easy way using API Platform
Building APIs in an easy way using API Platform
 
Champaign-Urbana Javascript Meetup Talk (Jan 2020)
Champaign-Urbana Javascript Meetup Talk (Jan 2020)Champaign-Urbana Javascript Meetup Talk (Jan 2020)
Champaign-Urbana Javascript Meetup Talk (Jan 2020)
 
Unlock dependency between client teams and API team with API mock and proxy
Unlock dependency between client teams and API team with API mock and proxyUnlock dependency between client teams and API team with API mock and proxy
Unlock dependency between client teams and API team with API mock and proxy
 
API Design in the Modern Era - Architecture Next 2020
API Design in the Modern Era - Architecture Next 2020API Design in the Modern Era - Architecture Next 2020
API Design in the Modern Era - Architecture Next 2020
 
Eran Stiller: API design in the modern era - architecture next 2020
Eran Stiller: API design in the modern era - architecture next 2020 Eran Stiller: API design in the modern era - architecture next 2020
Eran Stiller: API design in the modern era - architecture next 2020
 
Crafting Evolvable Api Responses
Crafting Evolvable Api ResponsesCrafting Evolvable Api Responses
Crafting Evolvable Api Responses
 
How to get along with HATEOAS without letting the bad guys steal your lunch -...
How to get along with HATEOAS without letting the bad guys steal your lunch -...How to get along with HATEOAS without letting the bad guys steal your lunch -...
How to get along with HATEOAS without letting the bad guys steal your lunch -...
 
web2py:Web development like a boss
web2py:Web development like a bossweb2py:Web development like a boss
web2py:Web development like a boss
 
Survival Strategies for API Documentation: Presentation to Southwestern Ontar...
Survival Strategies for API Documentation: Presentation to Southwestern Ontar...Survival Strategies for API Documentation: Presentation to Southwestern Ontar...
Survival Strategies for API Documentation: Presentation to Southwestern Ontar...
 

Más de tdc-globalcode

Más de tdc-globalcode (20)

TDC2019 Intel Software Day - Visao Computacional e IA a servico da humanidade
TDC2019 Intel Software Day - Visao Computacional e IA a servico da humanidadeTDC2019 Intel Software Day - Visao Computacional e IA a servico da humanidade
TDC2019 Intel Software Day - Visao Computacional e IA a servico da humanidade
 
TDC2019 Intel Software Day - Tecnicas de Programacao Paralela em Machine Lear...
TDC2019 Intel Software Day - Tecnicas de Programacao Paralela em Machine Lear...TDC2019 Intel Software Day - Tecnicas de Programacao Paralela em Machine Lear...
TDC2019 Intel Software Day - Tecnicas de Programacao Paralela em Machine Lear...
 
TDC2019 Intel Software Day - ACATE - Cases de Sucesso
TDC2019 Intel Software Day - ACATE - Cases de SucessoTDC2019 Intel Software Day - ACATE - Cases de Sucesso
TDC2019 Intel Software Day - ACATE - Cases de Sucesso
 
TDC2019 Intel Software Day - Otimizacao grafica com o Intel GPA
TDC2019 Intel Software Day - Otimizacao grafica com o Intel GPATDC2019 Intel Software Day - Otimizacao grafica com o Intel GPA
TDC2019 Intel Software Day - Otimizacao grafica com o Intel GPA
 
TDC2019 Intel Software Day - Deteccao de objetos em tempo real com OpenVino
TDC2019 Intel Software Day - Deteccao de objetos em tempo real com OpenVinoTDC2019 Intel Software Day - Deteccao de objetos em tempo real com OpenVino
TDC2019 Intel Software Day - Deteccao de objetos em tempo real com OpenVino
 
TDC2019 Intel Software Day - OpenCV: Inteligencia artificial e Visao Computac...
TDC2019 Intel Software Day - OpenCV: Inteligencia artificial e Visao Computac...TDC2019 Intel Software Day - OpenCV: Inteligencia artificial e Visao Computac...
TDC2019 Intel Software Day - OpenCV: Inteligencia artificial e Visao Computac...
 
TDC2019 Intel Software Day - Inferencia de IA em edge devices
TDC2019 Intel Software Day - Inferencia de IA em edge devicesTDC2019 Intel Software Day - Inferencia de IA em edge devices
TDC2019 Intel Software Day - Inferencia de IA em edge devices
 
Trilha BigData - Banco de Dados Orientado a Grafos na Seguranca Publica
Trilha BigData - Banco de Dados Orientado a Grafos na Seguranca PublicaTrilha BigData - Banco de Dados Orientado a Grafos na Seguranca Publica
Trilha BigData - Banco de Dados Orientado a Grafos na Seguranca Publica
 
Trilha .Net - Programacao funcional usando f#
Trilha .Net - Programacao funcional usando f#Trilha .Net - Programacao funcional usando f#
Trilha .Net - Programacao funcional usando f#
 
TDC2018SP | Trilha Go - Case Easylocus
TDC2018SP | Trilha Go - Case EasylocusTDC2018SP | Trilha Go - Case Easylocus
TDC2018SP | Trilha Go - Case Easylocus
 
TDC2018SP | Trilha Modern Web - Para onde caminha a Web?
TDC2018SP | Trilha Modern Web - Para onde caminha a Web?TDC2018SP | Trilha Modern Web - Para onde caminha a Web?
TDC2018SP | Trilha Modern Web - Para onde caminha a Web?
 
TDC2018SP | Trilha Go - Clean architecture em Golang
TDC2018SP | Trilha Go - Clean architecture em GolangTDC2018SP | Trilha Go - Clean architecture em Golang
TDC2018SP | Trilha Go - Clean architecture em Golang
 
TDC2018SP | Trilha Go - "Go" tambem e linguagem de QA
TDC2018SP | Trilha Go - "Go" tambem e linguagem de QATDC2018SP | Trilha Go - "Go" tambem e linguagem de QA
TDC2018SP | Trilha Go - "Go" tambem e linguagem de QA
 
TDC2018SP | Trilha Mobile - Digital Wallets - Seguranca, inovacao e tendencia
TDC2018SP | Trilha Mobile - Digital Wallets - Seguranca, inovacao e tendenciaTDC2018SP | Trilha Mobile - Digital Wallets - Seguranca, inovacao e tendencia
TDC2018SP | Trilha Mobile - Digital Wallets - Seguranca, inovacao e tendencia
 
TDC2018SP | Trilha .Net - Real Time apps com Azure SignalR Service
TDC2018SP | Trilha .Net - Real Time apps com Azure SignalR ServiceTDC2018SP | Trilha .Net - Real Time apps com Azure SignalR Service
TDC2018SP | Trilha .Net - Real Time apps com Azure SignalR Service
 
TDC2018SP | Trilha .Net - Passado, Presente e Futuro do .NET
TDC2018SP | Trilha .Net - Passado, Presente e Futuro do .NETTDC2018SP | Trilha .Net - Passado, Presente e Futuro do .NET
TDC2018SP | Trilha .Net - Passado, Presente e Futuro do .NET
 
TDC2018SP | Trilha .Net - Novidades do C# 7 e 8
TDC2018SP | Trilha .Net - Novidades do C# 7 e 8TDC2018SP | Trilha .Net - Novidades do C# 7 e 8
TDC2018SP | Trilha .Net - Novidades do C# 7 e 8
 
TDC2018SP | Trilha .Net - Obtendo metricas com TDD utilizando build automatiz...
TDC2018SP | Trilha .Net - Obtendo metricas com TDD utilizando build automatiz...TDC2018SP | Trilha .Net - Obtendo metricas com TDD utilizando build automatiz...
TDC2018SP | Trilha .Net - Obtendo metricas com TDD utilizando build automatiz...
 
TDC2018SP | Trilha .Net - .NET funcional com F#
TDC2018SP | Trilha .Net - .NET funcional com F#TDC2018SP | Trilha .Net - .NET funcional com F#
TDC2018SP | Trilha .Net - .NET funcional com F#
 
TDC2018SP | Trilha .Net - Crie SPAs com Razor e C# usando Blazor em .Net Core
TDC2018SP | Trilha .Net - Crie SPAs com Razor e C# usando Blazor  em .Net CoreTDC2018SP | Trilha .Net - Crie SPAs com Razor e C# usando Blazor  em .Net Core
TDC2018SP | Trilha .Net - Crie SPAs com Razor e C# usando Blazor em .Net Core
 

Último

Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
ciinovamais
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
QucHHunhnh
 

Último (20)

This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptx
 
ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
Towards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxTowards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptx
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan Fellows
 
Unit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxUnit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptx
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
Single or Multiple melodic lines structure
Single or Multiple melodic lines structureSingle or Multiple melodic lines structure
Single or Multiple melodic lines structure
 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and Modifications
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
 
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptxSKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 

TDC2016POA | Trilha Web - JSON API: não reinvente a roda

  • 1. Globalcode – Open4education JSON API: não reinvente a roda Pedro Cavalheiro Trilha Web
  • 2. Globalcode – Open4education Pedro Cavalheiro Desenvolvedor web há 6 anos, em sua maioria trabalhando com Ruby e PHP. Entusiasta por tecnologia como um todo, adora estudar novas ferramentas, linguagens e metodologias. Atualmente no Me Salva!. Infos em pecavalheiro.com
  • 4. Globalcode – Open4education API • Application Programming Interface • Web Services (HTTP) • SOAP • REST • JSON
  • 5. Globalcode – Open4education REST API • O que é importante? • Segurança/Autenticação • Documentação • Requisitos/Complexidade • Design de requisições/respostas • +
  • 7. Globalcode – Open4education bikeshed (noun) • (literally) An enclosed structure where bicycles may be stored. • (figuratively, technical jargon) A topic that is attracting debate ad nauseam, out of all proportion to its actual importance. Also bikeshedding, the process of futile investment of time and energy in discussion of marginal technical issues.
  • 11. Globalcode – Open4education JSON API • O que ele define? Just kidding!
  • 12. Globalcode – Open4education • Como um cliente deve consultar, criar e/ou modificar recursos. • Verbos • Formato da URL/Filtros • Paginação • + • Como o servidor deve responder a estas requisições. • Estrutura de resposta • Status Code • + JSON API • O que ele define?
  • 13. Globalcode – Open4education HTTP/1.1 200 OK Content-Type: application/vnd.api+json { "data": [{ "type": "articles", "id": "1", "attributes": { "title": "JSON API paints my bikeshed!", "body": "The shortest article. Ever.", "created": "2015-05-22T14:56:29.000Z", "updated": "2015-05-22T14:56:28.000Z" }, "relationships": { "author": { "data": {"id": "42", "type": "people"} } } }], "included": [ { "type": "people", "id": "42", "attributes": { "name": "John", "age": 80, "gender": "male" } } ] } GET /articles?include=author HTTP/1.1
  • 14. Globalcode – Open4education HTTP/1.1 200 OK Content-Type: application/vnd.api+json { "meta": { "total-pages": 13 }, "data": [ { "type": "articles", "id": "3", "attributes": { "title": "JSON API paints my bikeshed!", "body": "The shortest article. Ever.", "created": "2015-05-22T14:56:29.000Z", "updated": "2015-05-22T14:56:28.000Z" } } ], "links": { "self": "http://example.com/articles?page[number]=3&page[size]=1", "first": "http://example.com/articles?page[number]=1&page[size]=1", "prev": "http://example.com/articles?page[number]=2&page[size]=1", "next": "http://example.com/articles?page[number]=4&page[size]=1", "last": "http://example.com/articles?page[number]=13&page[size]=1" } } GET /articles?page[number]=3&page[size]=1 HTTP/1.1
  • 15. Globalcode – Open4education HTTP/1.1 422 Unprocessable Entity Content-Type: application/vnd.api+json { "errors": [ { "status": "422", "source": { "pointer": "/data/attributes/first-name" }, "title": "Invalid Attribute", "detail": "First name must contain at least three characters." } ] }
  • 16. Globalcode – Open4education JSON API • Implementação
  • 17. Globalcode – Open4education • Client libraries • JavaScript, iOS, Ruby, PHP, Dart, Perl, Java, Android, R, Elm, .NET • Server libraries • PHP, Node.js, Ruby, Python, Go, .NET, Java, Scala, Elixir, Haskell, Perl, Vala JSON API • Implementação - jsonapi.org/implementations
  • 18. Globalcode – Open4education Resumão • Calma! Ajuste uma parte de cada vez • JSON API não é “lei”, existem outros padrões: HAL, Siren, JSON-LD, Collection+JSON, etc • Adote padrões, eles facilitam nossa vida :)