SlideShare una empresa de Scribd logo
1 de 25
Descargar para leer sin conexión
JSON API Specification
Wojciech Langiewicz, https://www.wlangiewicz.com
1
JSON API
● Specification published in 2015:
http://www.cerebris.com/blog/2015/06/04/jsonapi-1-0/
● http://jsonapi.org/format/
● No large company behind it
2
What is JSON API?
Document describing multiple aspects of
how RESTful API should behave
3
What’s Covered By Specification?
● URL Structure
● How request should look like
● How response will look like
● How to perform server-side includes (fetching multiple related resources)
● How to publish and update documents
● How to handle errors
4
JSON API And Hypermedia
● HATEOAS - Hypermedia as the Engine of Application State
● Server can provide dynamic links
● Each of the links can have a meaning attached
● No need to hardcode URLs on the client side
● Clients can adapt to:
○ Contents of the response
○ Links returned which might allow them to traverse relationships
5
Motivation For Using JSON API Spec
● Anti-bikeshedding
● Formal specification and validation
● API-first approach
6
Bikeshedding
Technical disputes over minor, marginal issues conducted while more serious
ones are being overlooked. The implied image is of people arguing over what
color to paint the bicycle shed while the house is not finished.
Source: http://www.urbandictionary.com/define.php?term=bikeshedding
7
Formal Specification And Validation
● Documentation always up to date
● JSON Schema
● Validations
8
API-first Approach
● Design your API before implementing
● Prepare examples of requests and responses
● Validate examples against API Schema
● Replace examples with real implementations
9
Demo Time
10
Tooling
● Libraries
● JSON Schema
11
JSON API Libraries: Example Scala Library
● https://github.com/zalando/scala-jsonapi
● JSON API spec with Spray, Play! or Circe
● Example:
https://github.com/zalando/scala-jsonapi/blob/master/src/test/scala/org
/zalando/jsonapi/json/ExampleSpec.scala
12
case class Author(id: UUID, name: String, dateOfBirth: DateTime, dateOfDeath: Option[DateTime], createdAt:
DateTime, updatedAt: DateTime)
def toJsonapi(author: Author) = {
ResourceObject(
`type` = author.`type`,
id = Some(author.id),
attributes = authorAttributes(author),
relationships = authorRelationships(author),
links = List(Links.Self(selfLink(author))
)
}
def authorAttributes(author: Autor): Map[String, String] = { … }
def authorRelationships(author: Author): Map[String, Relationship] = { … }
def selfLink(author: Author): Link = Link(“/v1/author/${author.id}”)
13
JSON Schema
● A formal description of the JSON document
● Imposes restrictions about contents of the document and it’s structure
● Example (UUID):
"id": {
"type": "string",
"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
}
14
JSON API Problems
● Generic API
● Weird Workarounds
○ Actions
○ Image Upload
● Slower Pace of development
15
Generic API
● API serves many different clients OK (just OK)
● Not able to add specific operations for specific clients
● Some clients need to perform workarounds or unnecessary requests
● But at the same time our API doesn’t get skewed towards specific clients
16
Weird Workarounds: No Actions
● JSON API requires you to abandon “Actions”
● But you might need to compensate for it by working around the model
17
Weird Workarounds: Image Upload
● Standard thing expected by a lot of clients
● No support for it because of media type limitations
● Workarounds:
○ Base64 encode images and send them as JSON attributes
○ Use API server only as way to get “Image Id” - client will upload image somewhere else
○ …
18
Comparing JSON API To Alternatives
● GraphQL
● Swagger / Open API
● RAML
19
JSON API vs GraphQL
● http://graphql.org/learn/
● Alternative to JSON API
● Different approach to querying and results
● Query describes the structure of the document you are requesting
● Server side includes work by creating recursive tree structure
20
Swagger / Open API/ RAML
● Complement JSON API by having structure around documentation
● My suggested approach is to:
○ Design your API according to (JSON API) specification with JSON Schema
○ Use Swagger or RAML at the same time to give your API documentation a structure
○ Generate pretty HTML documentation out of RAML or use automatic Swagger tool to do
this
21
Where To Use JSON API?
● Larger projects with long lifespan
● Multiple clients with different use cases
22
Not So Good Use Cases
● Small projects or with short lifespan
● Internal APIs
● APIs dedicated to single client
23
Summary
● Implementing JSON API requires more work
● “Thinking in resources, not actions”
● Good specification in cases of larger projects
● For smaller projects consider RAML/Swagger
24
Thank you!
Wojciech Langiewicz, https://www.wlangiewicz.com
25

Más contenido relacionado

La actualidad más candente

The API Journey: GraphQL Specification and Implementation
The API Journey: GraphQL Specification and ImplementationThe API Journey: GraphQL Specification and Implementation
The API Journey: GraphQL Specification and ImplementationHaci Murat Yaman
 
Metadata and Access Control
Metadata and Access ControlMetadata and Access Control
Metadata and Access ControlNeo4j
 
From rest api to graph ql a 10 year journey
From rest api to graph ql a 10 year journeyFrom rest api to graph ql a 10 year journey
From rest api to graph ql a 10 year journeyArno Schulz
 
Apache Any23 - Anything to Triples
Apache Any23 - Anything to TriplesApache Any23 - Anything to Triples
Apache Any23 - Anything to TriplesMichele Mostarda
 
Comparison with storing data using NoSQL(CouchDB) and a relational database.
Comparison with storing data using NoSQL(CouchDB) and a relational database.Comparison with storing data using NoSQL(CouchDB) and a relational database.
Comparison with storing data using NoSQL(CouchDB) and a relational database.eross77
 
The Saga of JavaScript and TypeScript: Part 1
The Saga of JavaScript and TypeScript: Part 1The Saga of JavaScript and TypeScript: Part 1
The Saga of JavaScript and TypeScript: Part 1Haci Murat Yaman
 
GraphQL IndyJS April 2016
GraphQL IndyJS April 2016GraphQL IndyJS April 2016
GraphQL IndyJS April 2016Brad Pillow
 
GraphQL With Relay Part Deux
GraphQL With Relay Part DeuxGraphQL With Relay Part Deux
GraphQL With Relay Part DeuxBrad Pillow
 
MongoDB Hadoop DC
MongoDB Hadoop DCMongoDB Hadoop DC
MongoDB Hadoop DCMike Dirolf
 
DevNexus 2019: GraphQL From Beginner to Expert in 60 Minutes
DevNexus 2019: GraphQL From Beginner to Expert in 60 MinutesDevNexus 2019: GraphQL From Beginner to Expert in 60 Minutes
DevNexus 2019: GraphQL From Beginner to Expert in 60 MinutesYoel Spotts
 
BarCamp cloudsearch
BarCamp cloudsearchBarCamp cloudsearch
BarCamp cloudsearchkopertop
 
Getting Started with MongoDB using Node.js
Getting Started with MongoDB using Node.jsGetting Started with MongoDB using Node.js
Getting Started with MongoDB using Node.jsNic Raboy
 
Kotlin db migration tool
Kotlin db migration toolKotlin db migration tool
Kotlin db migration toolKenji Otsuka
 
Tikal Fuse Day Access Layer Implementation (C#) Based On Mongo Db
Tikal Fuse Day   Access Layer Implementation (C#) Based On Mongo DbTikal Fuse Day   Access Layer Implementation (C#) Based On Mongo Db
Tikal Fuse Day Access Layer Implementation (C#) Based On Mongo DbTikal Knowledge
 
Linked Data voor developers - PiLOD congres 25 juni
Linked Data voor developers - PiLOD congres 25 juniLinked Data voor developers - PiLOD congres 25 juni
Linked Data voor developers - PiLOD congres 25 juniDimitri van Hees
 
Taking Control of your Data with GraphQL
Taking Control of your Data with GraphQLTaking Control of your Data with GraphQL
Taking Control of your Data with GraphQLVinci Rufus
 
Post-relational databases: What's wrong with web development? v3
Post-relational databases: What's wrong with web development? v3Post-relational databases: What's wrong with web development? v3
Post-relational databases: What's wrong with web development? v3Dobrica Pavlinušić
 

La actualidad más candente (20)

The API Journey: GraphQL Specification and Implementation
The API Journey: GraphQL Specification and ImplementationThe API Journey: GraphQL Specification and Implementation
The API Journey: GraphQL Specification and Implementation
 
Angular universal
Angular universalAngular universal
Angular universal
 
GraphQL & Relay
GraphQL & RelayGraphQL & Relay
GraphQL & Relay
 
Metadata and Access Control
Metadata and Access ControlMetadata and Access Control
Metadata and Access Control
 
From rest api to graph ql a 10 year journey
From rest api to graph ql a 10 year journeyFrom rest api to graph ql a 10 year journey
From rest api to graph ql a 10 year journey
 
Apache Any23 - Anything to Triples
Apache Any23 - Anything to TriplesApache Any23 - Anything to Triples
Apache Any23 - Anything to Triples
 
Comparison with storing data using NoSQL(CouchDB) and a relational database.
Comparison with storing data using NoSQL(CouchDB) and a relational database.Comparison with storing data using NoSQL(CouchDB) and a relational database.
Comparison with storing data using NoSQL(CouchDB) and a relational database.
 
The Saga of JavaScript and TypeScript: Part 1
The Saga of JavaScript and TypeScript: Part 1The Saga of JavaScript and TypeScript: Part 1
The Saga of JavaScript and TypeScript: Part 1
 
GraphQL IndyJS April 2016
GraphQL IndyJS April 2016GraphQL IndyJS April 2016
GraphQL IndyJS April 2016
 
GraphQL With Relay Part Deux
GraphQL With Relay Part DeuxGraphQL With Relay Part Deux
GraphQL With Relay Part Deux
 
MongoDB Hadoop DC
MongoDB Hadoop DCMongoDB Hadoop DC
MongoDB Hadoop DC
 
DevNexus 2019: GraphQL From Beginner to Expert in 60 Minutes
DevNexus 2019: GraphQL From Beginner to Expert in 60 MinutesDevNexus 2019: GraphQL From Beginner to Expert in 60 Minutes
DevNexus 2019: GraphQL From Beginner to Expert in 60 Minutes
 
BarCamp cloudsearch
BarCamp cloudsearchBarCamp cloudsearch
BarCamp cloudsearch
 
Getting Started with MongoDB using Node.js
Getting Started with MongoDB using Node.jsGetting Started with MongoDB using Node.js
Getting Started with MongoDB using Node.js
 
Introduction to Grails
Introduction to GrailsIntroduction to Grails
Introduction to Grails
 
Kotlin db migration tool
Kotlin db migration toolKotlin db migration tool
Kotlin db migration tool
 
Tikal Fuse Day Access Layer Implementation (C#) Based On Mongo Db
Tikal Fuse Day   Access Layer Implementation (C#) Based On Mongo DbTikal Fuse Day   Access Layer Implementation (C#) Based On Mongo Db
Tikal Fuse Day Access Layer Implementation (C#) Based On Mongo Db
 
Linked Data voor developers - PiLOD congres 25 juni
Linked Data voor developers - PiLOD congres 25 juniLinked Data voor developers - PiLOD congres 25 juni
Linked Data voor developers - PiLOD congres 25 juni
 
Taking Control of your Data with GraphQL
Taking Control of your Data with GraphQLTaking Control of your Data with GraphQL
Taking Control of your Data with GraphQL
 
Post-relational databases: What's wrong with web development? v3
Post-relational databases: What's wrong with web development? v3Post-relational databases: What's wrong with web development? v3
Post-relational databases: What's wrong with web development? v3
 

Similar a JSON API Specificiation

GraphQL in an Age of REST
GraphQL in an Age of RESTGraphQL in an Age of REST
GraphQL in an Age of RESTYos Riady
 
API Design & Security in django
API Design & Security in djangoAPI Design & Security in django
API Design & Security in djangoTareque Hossain
 
A Snapshot of API Design Trends In 2019
A Snapshot of API Design Trends In 2019A Snapshot of API Design Trends In 2019
A Snapshot of API Design Trends In 2019Bill Doerrfeld
 
apidays LIVE Australia 2020 - Have your cake and eat it too: GraphQL? REST? W...
apidays LIVE Australia 2020 - Have your cake and eat it too: GraphQL? REST? W...apidays LIVE Australia 2020 - Have your cake and eat it too: GraphQL? REST? W...
apidays LIVE Australia 2020 - Have your cake and eat it too: GraphQL? REST? W...apidays
 
GraphQL is actually rest
GraphQL is actually restGraphQL is actually rest
GraphQL is actually restJakub Riedl
 
Introduction to GraphQL
Introduction to GraphQLIntroduction to GraphQL
Introduction to GraphQLRodrigo Prates
 
Create responsive websites with Django, REST and AngularJS
Create responsive websites with Django, REST and AngularJSCreate responsive websites with Django, REST and AngularJS
Create responsive websites with Django, REST and AngularJSHannes Hapke
 
Getting started with node JS
Getting started with node JSGetting started with node JS
Getting started with node JSHamdi Hmidi
 
Building Beautiful REST APIs with ASP.NET Core
Building Beautiful REST APIs with ASP.NET CoreBuilding Beautiful REST APIs with ASP.NET Core
Building Beautiful REST APIs with ASP.NET CoreStormpath
 
Tutorial: Building a GraphQL API in PHP
Tutorial: Building a GraphQL API in PHPTutorial: Building a GraphQL API in PHP
Tutorial: Building a GraphQL API in PHPAndrew Rota
 
2.28.17 Introducing DSpace 7 Webinar Slides
2.28.17 Introducing DSpace 7 Webinar Slides2.28.17 Introducing DSpace 7 Webinar Slides
2.28.17 Introducing DSpace 7 Webinar SlidesDuraSpace
 
Creating a custom API for a headless Drupal
Creating a custom API for a headless DrupalCreating a custom API for a headless Drupal
Creating a custom API for a headless DrupalExove
 
Designing a json/rest api for your mobile app
Designing a json/rest api for your mobile appDesigning a json/rest api for your mobile app
Designing a json/rest api for your mobile appOlivier Destrebecq
 
JSON, JSON Schema, and OpenAPI
JSON, JSON Schema, and OpenAPIJSON, JSON Schema, and OpenAPI
JSON, JSON Schema, and OpenAPIOctavian Nadolu
 

Similar a JSON API Specificiation (20)

GraphQL in an Age of REST
GraphQL in an Age of RESTGraphQL in an Age of REST
GraphQL in an Age of REST
 
OpenAPI Extensions for OSLC
OpenAPI Extensions for OSLCOpenAPI Extensions for OSLC
OpenAPI Extensions for OSLC
 
API Design & Security in django
API Design & Security in djangoAPI Design & Security in django
API Design & Security in django
 
A Snapshot of API Design Trends In 2019
A Snapshot of API Design Trends In 2019A Snapshot of API Design Trends In 2019
A Snapshot of API Design Trends In 2019
 
apidays LIVE Australia 2020 - Have your cake and eat it too: GraphQL? REST? W...
apidays LIVE Australia 2020 - Have your cake and eat it too: GraphQL? REST? W...apidays LIVE Australia 2020 - Have your cake and eat it too: GraphQL? REST? W...
apidays LIVE Australia 2020 - Have your cake and eat it too: GraphQL? REST? W...
 
ArangoDB
ArangoDBArangoDB
ArangoDB
 
Cloud Native API Design and Management
Cloud Native API Design and ManagementCloud Native API Design and Management
Cloud Native API Design and Management
 
GraphQL is actually rest
GraphQL is actually restGraphQL is actually rest
GraphQL is actually rest
 
Introduction to GraphQL
Introduction to GraphQLIntroduction to GraphQL
Introduction to GraphQL
 
Dust.js
Dust.jsDust.js
Dust.js
 
Create responsive websites with Django, REST and AngularJS
Create responsive websites with Django, REST and AngularJSCreate responsive websites with Django, REST and AngularJS
Create responsive websites with Django, REST and AngularJS
 
Getting started with node JS
Getting started with node JSGetting started with node JS
Getting started with node JS
 
Building Beautiful REST APIs with ASP.NET Core
Building Beautiful REST APIs with ASP.NET CoreBuilding Beautiful REST APIs with ASP.NET Core
Building Beautiful REST APIs with ASP.NET Core
 
Graphql usage
Graphql usageGraphql usage
Graphql usage
 
Hands On - GraphQL
Hands On - GraphQLHands On - GraphQL
Hands On - GraphQL
 
Tutorial: Building a GraphQL API in PHP
Tutorial: Building a GraphQL API in PHPTutorial: Building a GraphQL API in PHP
Tutorial: Building a GraphQL API in PHP
 
2.28.17 Introducing DSpace 7 Webinar Slides
2.28.17 Introducing DSpace 7 Webinar Slides2.28.17 Introducing DSpace 7 Webinar Slides
2.28.17 Introducing DSpace 7 Webinar Slides
 
Creating a custom API for a headless Drupal
Creating a custom API for a headless DrupalCreating a custom API for a headless Drupal
Creating a custom API for a headless Drupal
 
Designing a json/rest api for your mobile app
Designing a json/rest api for your mobile appDesigning a json/rest api for your mobile app
Designing a json/rest api for your mobile app
 
JSON, JSON Schema, and OpenAPI
JSON, JSON Schema, and OpenAPIJSON, JSON Schema, and OpenAPI
JSON, JSON Schema, and OpenAPI
 

Más de Wojciech Langiewicz

Más de Wojciech Langiewicz (9)

Bitcoin: introduction for programmers - Pecha Kucha
Bitcoin:   introduction for programmers - Pecha KuchaBitcoin:   introduction for programmers - Pecha Kucha
Bitcoin: introduction for programmers - Pecha Kucha
 
Ionic 2 intro
Ionic 2   introIonic 2   intro
Ionic 2 intro
 
Mutation testing in Java
Mutation testing in JavaMutation testing in Java
Mutation testing in Java
 
Bitcoin for programmers - part 1 version 2
Bitcoin for programmers - part 1 version 2Bitcoin for programmers - part 1 version 2
Bitcoin for programmers - part 1 version 2
 
Introduction to Bitcoin for programmers
Introduction to Bitcoin for programmersIntroduction to Bitcoin for programmers
Introduction to Bitcoin for programmers
 
2014 hadoop wrocław jug
2014 hadoop   wrocław jug2014 hadoop   wrocław jug
2014 hadoop wrocław jug
 
Badanie skalowalności HBase
Badanie skalowalności HBaseBadanie skalowalności HBase
Badanie skalowalności HBase
 
Introduction to Octopress at DRUG
Introduction to Octopress at DRUGIntroduction to Octopress at DRUG
Introduction to Octopress at DRUG
 
Hadoop w NK.pl
Hadoop w NK.plHadoop w NK.pl
Hadoop w NK.pl
 

Último

Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsArshad QA
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsAlberto González Trastoy
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...kellynguyen01
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsJhone kinadey
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxComplianceQuest1
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsAndolasoft Inc
 
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female serviceCALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female serviceanilsa9823
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...MyIntelliSource, Inc.
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdfWave PLM
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providermohitmore19
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...Health
 
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AIABDERRAOUF MEHENNI
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVshikhaohhpro
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...MyIntelliSource, Inc.
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...panagenda
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...ICS
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfkalichargn70th171
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionSolGuruz
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerThousandEyes
 

Último (20)

Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docx
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.js
 
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female serviceCALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with Precision
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
 

JSON API Specificiation

  • 1. JSON API Specification Wojciech Langiewicz, https://www.wlangiewicz.com 1
  • 2. JSON API ● Specification published in 2015: http://www.cerebris.com/blog/2015/06/04/jsonapi-1-0/ ● http://jsonapi.org/format/ ● No large company behind it 2
  • 3. What is JSON API? Document describing multiple aspects of how RESTful API should behave 3
  • 4. What’s Covered By Specification? ● URL Structure ● How request should look like ● How response will look like ● How to perform server-side includes (fetching multiple related resources) ● How to publish and update documents ● How to handle errors 4
  • 5. JSON API And Hypermedia ● HATEOAS - Hypermedia as the Engine of Application State ● Server can provide dynamic links ● Each of the links can have a meaning attached ● No need to hardcode URLs on the client side ● Clients can adapt to: ○ Contents of the response ○ Links returned which might allow them to traverse relationships 5
  • 6. Motivation For Using JSON API Spec ● Anti-bikeshedding ● Formal specification and validation ● API-first approach 6
  • 7. Bikeshedding Technical disputes over minor, marginal issues conducted while more serious ones are being overlooked. The implied image is of people arguing over what color to paint the bicycle shed while the house is not finished. Source: http://www.urbandictionary.com/define.php?term=bikeshedding 7
  • 8. Formal Specification And Validation ● Documentation always up to date ● JSON Schema ● Validations 8
  • 9. API-first Approach ● Design your API before implementing ● Prepare examples of requests and responses ● Validate examples against API Schema ● Replace examples with real implementations 9
  • 12. JSON API Libraries: Example Scala Library ● https://github.com/zalando/scala-jsonapi ● JSON API spec with Spray, Play! or Circe ● Example: https://github.com/zalando/scala-jsonapi/blob/master/src/test/scala/org /zalando/jsonapi/json/ExampleSpec.scala 12
  • 13. case class Author(id: UUID, name: String, dateOfBirth: DateTime, dateOfDeath: Option[DateTime], createdAt: DateTime, updatedAt: DateTime) def toJsonapi(author: Author) = { ResourceObject( `type` = author.`type`, id = Some(author.id), attributes = authorAttributes(author), relationships = authorRelationships(author), links = List(Links.Self(selfLink(author)) ) } def authorAttributes(author: Autor): Map[String, String] = { … } def authorRelationships(author: Author): Map[String, Relationship] = { … } def selfLink(author: Author): Link = Link(“/v1/author/${author.id}”) 13
  • 14. JSON Schema ● A formal description of the JSON document ● Imposes restrictions about contents of the document and it’s structure ● Example (UUID): "id": { "type": "string", "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$" } 14
  • 15. JSON API Problems ● Generic API ● Weird Workarounds ○ Actions ○ Image Upload ● Slower Pace of development 15
  • 16. Generic API ● API serves many different clients OK (just OK) ● Not able to add specific operations for specific clients ● Some clients need to perform workarounds or unnecessary requests ● But at the same time our API doesn’t get skewed towards specific clients 16
  • 17. Weird Workarounds: No Actions ● JSON API requires you to abandon “Actions” ● But you might need to compensate for it by working around the model 17
  • 18. Weird Workarounds: Image Upload ● Standard thing expected by a lot of clients ● No support for it because of media type limitations ● Workarounds: ○ Base64 encode images and send them as JSON attributes ○ Use API server only as way to get “Image Id” - client will upload image somewhere else ○ … 18
  • 19. Comparing JSON API To Alternatives ● GraphQL ● Swagger / Open API ● RAML 19
  • 20. JSON API vs GraphQL ● http://graphql.org/learn/ ● Alternative to JSON API ● Different approach to querying and results ● Query describes the structure of the document you are requesting ● Server side includes work by creating recursive tree structure 20
  • 21. Swagger / Open API/ RAML ● Complement JSON API by having structure around documentation ● My suggested approach is to: ○ Design your API according to (JSON API) specification with JSON Schema ○ Use Swagger or RAML at the same time to give your API documentation a structure ○ Generate pretty HTML documentation out of RAML or use automatic Swagger tool to do this 21
  • 22. Where To Use JSON API? ● Larger projects with long lifespan ● Multiple clients with different use cases 22
  • 23. Not So Good Use Cases ● Small projects or with short lifespan ● Internal APIs ● APIs dedicated to single client 23
  • 24. Summary ● Implementing JSON API requires more work ● “Thinking in resources, not actions” ● Good specification in cases of larger projects ● For smaller projects consider RAML/Swagger 24
  • 25. Thank you! Wojciech Langiewicz, https://www.wlangiewicz.com 25