SlideShare a Scribd company logo
pen4education
JSON API: não reinvente a roda
Pedro Cavalheiro
Trilha Web
pen4education
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
pen4education
Did I hear API?
pen4education
API
• Application Programming Interface
• Web Services (HTTP)
• SOAP
• REST
• JSON
pen4education
REST API
• O que é importante?
• Segurança/Autenticação
• Documentação
• Requisitos/Complexidade
• Design de requisições/respostas
• +
pen4education
pen4education
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.
pen4education
pen4education
Did I hear API?
pen4education
Did I hear API?
pen4education
JSON API
• O que ele define?
Just kidding!
pen4education
• 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?
pen4education
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
pen4education
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
pen4education
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."
}
]
}
pen4education
JSON API
• Implementação
pen4education
• 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
pen4education
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 :)
pen4education
Dúvidas?
jsonapi.org
pecavalheiro.com
OBRIGADO!

More Related Content

PDF
Together Cheerfully to Walk with Hypermedia
ODP
NEPHP '13: Pragmatic API Development
PPTX
Austin Day of Rest - Introduction
PDF
Hypermedia: The Missing Element to Building Adaptable Web APIs in Rails
PDF
Resource-Oriented Architecture (ROA) and REST
PPTX
Building Beautiful REST APIs in ASP.NET Core
PDF
How to build a rest api.pptx
PDF
Reviewing RESTful Web Apps
Together Cheerfully to Walk with Hypermedia
NEPHP '13: Pragmatic API Development
Austin Day of Rest - Introduction
Hypermedia: The Missing Element to Building Adaptable Web APIs in Rails
Resource-Oriented Architecture (ROA) and REST
Building Beautiful REST APIs in ASP.NET Core
How to build a rest api.pptx
Reviewing RESTful Web Apps

What's hot (10)

ODP
The Internet as Web Services: introduction to ReST
PDF
The never-ending REST API design debate
PPTX
REST API Design & Development
PDF
API Design & Security in django
KEY
Rest and the hypermedia constraint
PDF
Rest api design by george reese
PDF
Best Practices in Web Service Design
PDF
Preparing your web services for Android and your Android app for web services...
PDF
LAWDI - Rogue Linked Data
PDF
Representational State Transfer (REST)
The Internet as Web Services: introduction to ReST
The never-ending REST API design debate
REST API Design & Development
API Design & Security in django
Rest and the hypermedia constraint
Rest api design by george reese
Best Practices in Web Service Design
Preparing your web services for Android and your Android app for web services...
LAWDI - Rogue Linked Data
Representational State Transfer (REST)
Ad

Viewers also liked (20)

PPT
дипломная презентация по коммерческим банкам
PDF
T0003362
PPTX
Trabajo de spd 2
PDF
Sept. CTA
PPT
дипломная презентация по управлению кадрами
DOCX
Resumo para a prova de apocalipse
PDF
问答篇——真理从何可知
PPT
3 бурдаеввп 2014_pax_grid_без_анимации
PPT
дипломная презентация по управлению финансовыми результатами
PPTX
Code Crime Scene pawel klimczyk
PPT
12_-_Collections_Framework
PPT
Software testing strategies
PPT
Software Processes
PPT
PDF
Lista de Chequeo Scrum
PDF
2 - OOPS
PPTX
Figuras para explicação responsabilidade
PDF
VIEW26 - for software quality professionals
PPTX
LSI - PMP - Training material
PPT
Recruitment_Process[1]
дипломная презентация по коммерческим банкам
T0003362
Trabajo de spd 2
Sept. CTA
дипломная презентация по управлению кадрами
Resumo para a prova de apocalipse
问答篇——真理从何可知
3 бурдаеввп 2014_pax_grid_без_анимации
дипломная презентация по управлению финансовыми результатами
Code Crime Scene pawel klimczyk
12_-_Collections_Framework
Software testing strategies
Software Processes
Lista de Chequeo Scrum
2 - OOPS
Figuras para explicação responsabilidade
VIEW26 - for software quality professionals
LSI - PMP - Training material
Recruitment_Process[1]
Ad

Similar to JSON API: Não reinvente a roda (20)

PDF
TDC2016POA | Trilha Web - JSON API: não reinvente a roda
PDF
JSON API Standards
PDF
Sliding away from Roy Fielding's REST model (Filippos Vasilakis)
PPT
Web api's
PPTX
Rest Essentials
PDF
RESTful HATEOAS standards using Java based Katharsis
PDF
RESTful HATEOAS standards using Java based Katharsis
PDF
JSON API Specificiation
PDF
Introduction to REST - REST Basics - JSON
PPTX
Stop the noise! - Introduction to the JSON:API specification in Drupal
PPTX
rest-api-basics.pptx
PDF
REST APIS web development for backend familiarity
PPT
Tutorial Linked APIs
PPTX
Reto2.011 APEX API
PDF
David Gómez G. - Hypermedia APIs for headless platforms and Data Integration ...
PDF
Cdm mil-18 - hypermedia ap is for headless platforms and data integration
PPTX
REST library.pptx
PDF
X api chinese cop monthly meeting feb.2016
PPTX
L18 REST API Design
PPTX
Decoupling Edutopia.org
TDC2016POA | Trilha Web - JSON API: não reinvente a roda
JSON API Standards
Sliding away from Roy Fielding's REST model (Filippos Vasilakis)
Web api's
Rest Essentials
RESTful HATEOAS standards using Java based Katharsis
RESTful HATEOAS standards using Java based Katharsis
JSON API Specificiation
Introduction to REST - REST Basics - JSON
Stop the noise! - Introduction to the JSON:API specification in Drupal
rest-api-basics.pptx
REST APIS web development for backend familiarity
Tutorial Linked APIs
Reto2.011 APEX API
David Gómez G. - Hypermedia APIs for headless platforms and Data Integration ...
Cdm mil-18 - hypermedia ap is for headless platforms and data integration
REST library.pptx
X api chinese cop monthly meeting feb.2016
L18 REST API Design
Decoupling Edutopia.org

Recently uploaded (20)

PDF
Internet Downloader Manager (IDM) Crack 6.42 Build 41
PDF
How to Migrate SBCGlobal Email to Yahoo Easily
PPTX
Agentic AI Use Case- Contract Lifecycle Management (CLM).pptx
PDF
Design an Analysis of Algorithms I-SECS-1021-03
PDF
How Creative Agencies Leverage Project Management Software.pdf
PDF
wealthsignaloriginal-com-DS-text-... (1).pdf
PDF
Navsoft: AI-Powered Business Solutions & Custom Software Development
PPTX
CHAPTER 2 - PM Management and IT Context
PDF
Odoo Companies in India – Driving Business Transformation.pdf
PDF
Digital Strategies for Manufacturing Companies
PDF
Addressing The Cult of Project Management Tools-Why Disconnected Work is Hold...
PDF
Adobe Premiere Pro 2025 (v24.5.0.057) Crack free
PPTX
Agentic AI : A Practical Guide. Undersating, Implementing and Scaling Autono...
PDF
Which alternative to Crystal Reports is best for small or large businesses.pdf
PDF
top salesforce developer skills in 2025.pdf
PDF
PTS Company Brochure 2025 (1).pdf.......
PDF
EN-Survey-Report-SAP-LeanIX-EA-Insights-2025.pdf
PDF
Softaken Excel to vCard Converter Software.pdf
PPTX
history of c programming in notes for students .pptx
PPTX
L1 - Introduction to python Backend.pptx
Internet Downloader Manager (IDM) Crack 6.42 Build 41
How to Migrate SBCGlobal Email to Yahoo Easily
Agentic AI Use Case- Contract Lifecycle Management (CLM).pptx
Design an Analysis of Algorithms I-SECS-1021-03
How Creative Agencies Leverage Project Management Software.pdf
wealthsignaloriginal-com-DS-text-... (1).pdf
Navsoft: AI-Powered Business Solutions & Custom Software Development
CHAPTER 2 - PM Management and IT Context
Odoo Companies in India – Driving Business Transformation.pdf
Digital Strategies for Manufacturing Companies
Addressing The Cult of Project Management Tools-Why Disconnected Work is Hold...
Adobe Premiere Pro 2025 (v24.5.0.057) Crack free
Agentic AI : A Practical Guide. Undersating, Implementing and Scaling Autono...
Which alternative to Crystal Reports is best for small or large businesses.pdf
top salesforce developer skills in 2025.pdf
PTS Company Brochure 2025 (1).pdf.......
EN-Survey-Report-SAP-LeanIX-EA-Insights-2025.pdf
Softaken Excel to vCard Converter Software.pdf
history of c programming in notes for students .pptx
L1 - Introduction to python Backend.pptx

JSON API: Não reinvente a roda

  • 1. pen4education JSON API: não reinvente a roda Pedro Cavalheiro Trilha Web
  • 2. pen4education 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. pen4education API • Application Programming Interface • Web Services (HTTP) • SOAP • REST • JSON
  • 5. pen4education REST API • O que é importante? • Segurança/Autenticação • Documentação • Requisitos/Complexidade • Design de requisições/respostas • +
  • 7. pen4education 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. pen4education JSON API • O que ele define? Just kidding!
  • 12. pen4education • 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. pen4education 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. pen4education 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. pen4education 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." } ] }
  • 17. pen4education • 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. pen4education 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 :)