SlideShare a Scribd company logo
The New Kids on the Data Block		JSON 		and		REST
RESTWhat does it stand for?: 	Representational StateTransfer What Is it?A style of software architecture for distributed systemsWho/Where/When?	Came about in 2000 doctoral dissertation of Roy Fielding – but it’s been used for much longer
REST – Core Principal
REST – Where/How: Simple ExamplePremise: Data in a table could be a resource we want to read	Database server called  bbddb01Database called northwindTable called usershttp://bbddb01/northwind/users
What, What, What?What type of content you return is up to you.Compare to SOAP where you must return XML.Most common are XML or JSON. You could return complex types like a picture.
REST – Is it used?Web sites are RESTfulRSS is RESTfulTwitter, Flickr and Amazon expose data using RESTSome things are “accidentally RESTful” in that they offer limited support.
Real Life: Flickr APIResource: PhotosWhere:http://farm{farm-id}.static.flickr.com/{server-id}/{id}_{secret}.jpg
http://farm{farm-id}.static.flickr.com/{server-id}/{id}_{secret}_[mstb].jpg
 http://farm{farm-id}.static.flickr.com/{server-id}/{id}_{o-secret}_o.(jpg|gif|png)What: JPEG, GIF or PNG (defined in the URL)http://farm1.static.flickr.com/2/1418878_1e92283336_m.jpg
REST – MethodsHTTP Methods are a key corner stone in REST. They define the action to be taken with a URL.Proper RESTful services expose all four – “accidental” expose less.Nothing stopping you doing some Mix & MatchSome URL’s offering all of them and others a limited setWhat are the four methods and what should they do?
REST – Methods Examplehttp://bbddb01/northwind/users[firstname=“rob%”]+ POST = Error + GET = Returns everyone who begins with rob+ PUT = Error+ DELETE = Deletes everyone who begins with robhttp://bbddb01/northwind/users& we add some input data+ POST = Creates a new user+ GET = Returns everyone who meets criteria+ PUT = Creates/Updates a user (based on data)+ DELETE = Deletes everyone who meets criteria
REST – Methods Examplehttp://bbddb01/northwind/users[firstname=“rob%”]+ POST = Error + PUT = ErrorWhat would the error be?HTTP 400 or 500 errors are normally used to indicate problems – same as websites
REST – CommandsYou can associate commands with a resource. Commands can replace the need for using HTTP methods and can provide a more familiar way of dealing with data.Example:userResource = new Resource('http://example.com/users/001') userResource.delete()
Comparing apples and orangesFIGHT: REST vs. SOAP
REST vs. SOAP – pt I: Technology
REST vs. SOAP – pt II: Languages
REST vs. SOAP – pt III: Tools
FAQ about Security?Are RESTful services secure?	It’s a style, not a technology so that depends on how you implement it.Are you open to SQL injection attacks?When you look at http://bbddb01/northwind/users[firstname=“rob%”], you may think so but you shouldn’t be. Because:The parameter shouldn’t be SQLIf it is SQL, why are you not filtering it?Remember the old rule: Do not trust user input
FAQ about Security?How can I do authentication?It’s built on HTTP, so everything you have for authentication in HTTP is availablePLUSYou could encode your authentication requirements into the input fields
DEMOBuilding a RESTful database with ADO.NET Data Services
JSON – What is it?“JSON (JavaScript Object Notation) is a lightweight data-interchange format. It is easy for humans to read and write. It is easy for machines to parse and generate” – JSON.orgImportantly: JSON is a subset of JavaScript
JSON – What does it look like?{"firstName": "John","lastName": "Smith","address": {"streetAddress": "21 2nd Street","city": "New York","state": "NY","postalCode": 10021},"phoneNumbers": ["212 555-1234","646 555-4567"]}Name/Value PairsChild propertiesNumber data typeString Array
JSON Data Structures
DemoJSON Basics
ADO.NET Data Services & JSONDemo
More on jQuery?What: jQuery TRWho: ReinWhere: BB&D CollabWhen: 20th May 2009
Aren’t they the same?FIGHT: JSON vs XML

More Related Content

PPTX
JSON: The Basics
PPTX
Overview of Rest Service and ASP.NET WEB API
PDF
What is REST API? REST API Concepts and Examples | Edureka
PPT
Java Persistence API (JPA) Step By Step
PPTX
Design Beautiful REST + JSON APIs
PPTX
REST-API introduction for developers
PPTX
REST & RESTful Web Services
JSON: The Basics
Overview of Rest Service and ASP.NET WEB API
What is REST API? REST API Concepts and Examples | Edureka
Java Persistence API (JPA) Step By Step
Design Beautiful REST + JSON APIs
REST-API introduction for developers
REST & RESTful Web Services

What's hot (20)

PPTX
oops concept in java | object oriented programming in java
PPTX
ReactJS presentation.pptx
PPT
Understanding REST
PDF
REST API and CRUD
PDF
API for Beginners
PPTX
PPTX
Soap vs rest
PPT
Java Servlets
PPTX
Python-Polymorphism.pptx
PPTX
PYTHON PPT.pptx
PPT
Intro to web services
PPT
Class 5 - PHP Strings
PPTX
css.ppt
PPTX
Packages in java
PPTX
PPTX
Web services SOAP
PPSX
JDBC: java DataBase connectivity
PPTX
Web services
PPT
Java Networking
oops concept in java | object oriented programming in java
ReactJS presentation.pptx
Understanding REST
REST API and CRUD
API for Beginners
Soap vs rest
Java Servlets
Python-Polymorphism.pptx
PYTHON PPT.pptx
Intro to web services
Class 5 - PHP Strings
css.ppt
Packages in java
Web services SOAP
JDBC: java DataBase connectivity
Web services
Java Networking
Ad

Similar to JSON and REST (20)

PPT
The Evolving Security Environment For Web Services
ODP
The Internet as Web Services: introduction to ReST
PPT
Web services - REST and SOAP
PPT
RESTful services
PPTX
PPTX
Phalcon 2 High Performance APIs - DevWeekPOA 2015
PPTX
Web services soap and rest by mandakini for TechGig
PDF
WordPress REST API v2: Overview & Exploring
ODP
Introducing CouchDB
PPTX
working with PHP & DB's
PPT
Restful web services
PPT
Hanoi php day 2008 - 05. nguyen hai nhat huy - building-restful-web-service-w...
PPTX
RESTful design
PPT
Document Databases & RavenDB
PPT
Helping Things to REST
PPTX
Introduction To REST
PDF
Web Services, for DevDays Belfast
PPT
Java Script Based Client Server Webapps 2
PDF
What is API - Understanding API Simplified
The Evolving Security Environment For Web Services
The Internet as Web Services: introduction to ReST
Web services - REST and SOAP
RESTful services
Phalcon 2 High Performance APIs - DevWeekPOA 2015
Web services soap and rest by mandakini for TechGig
WordPress REST API v2: Overview & Exploring
Introducing CouchDB
working with PHP & DB's
Restful web services
Hanoi php day 2008 - 05. nguyen hai nhat huy - building-restful-web-service-w...
RESTful design
Document Databases & RavenDB
Helping Things to REST
Introduction To REST
Web Services, for DevDays Belfast
Java Script Based Client Server Webapps 2
What is API - Understanding API Simplified
Ad

More from Robert MacLean (20)

PPTX
Deno ...................................
PPTX
14 things you need to be a successful software developer (v3)
PPTX
OWASP TOP 10
PPTX
Building a µservice with Kotlin, Micronaut & GCP
PPTX
Looking at the Vue
PPTX
Kotlin 101
PPTX
Features of Kotlin I find exciting
PPTX
JavaScript Gotchas
PPTX
DevConf Survival Guide
PPTX
The state of testing @ Microsoft
PPTX
Visual Studio ❤ JavaScript
PPTX
What is new in C# 6?
PPTX
Putting the DOT in .NET - Dev/Ops/Test
PPTX
A Developer Day 2014 - Durban
PPTX
Agile lessons learned in the Microsoft ALM Rangers
PPTX
Hour of code - Train the trainer
PPTX
Building services for apps on a shoestring budget
PPTX
3 things your app API is doing WRONG
PPTX
Deno ...................................
14 things you need to be a successful software developer (v3)
OWASP TOP 10
Building a µservice with Kotlin, Micronaut & GCP
Looking at the Vue
Kotlin 101
Features of Kotlin I find exciting
JavaScript Gotchas
DevConf Survival Guide
The state of testing @ Microsoft
Visual Studio ❤ JavaScript
What is new in C# 6?
Putting the DOT in .NET - Dev/Ops/Test
A Developer Day 2014 - Durban
Agile lessons learned in the Microsoft ALM Rangers
Hour of code - Train the trainer
Building services for apps on a shoestring budget
3 things your app API is doing WRONG

Recently uploaded (20)

PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PPTX
breach-and-attack-simulation-cybersecurity-india-chennai-defenderrabbit-2025....
PDF
NewMind AI Monthly Chronicles - July 2025
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PDF
Advanced Soft Computing BINUS July 2025.pdf
PPTX
Comunidade Salesforce São Paulo - Desmistificando o Omnistudio (Vlocity)
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PDF
Review of recent advances in non-invasive hemoglobin estimation
PDF
Transforming Manufacturing operations through Intelligent Integrations
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PPTX
Cloud computing and distributed systems.
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PDF
Spectral efficient network and resource selection model in 5G networks
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PPTX
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
PDF
Modernizing your data center with Dell and AMD
PDF
AI And Its Effect On The Evolving IT Sector In Australia - Elevate
PPTX
Big Data Technologies - Introduction.pptx
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PDF
CIFDAQ's Market Wrap: Ethereum Leads, Bitcoin Lags, Institutions Shift
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
breach-and-attack-simulation-cybersecurity-india-chennai-defenderrabbit-2025....
NewMind AI Monthly Chronicles - July 2025
Diabetes mellitus diagnosis method based random forest with bat algorithm
Advanced Soft Computing BINUS July 2025.pdf
Comunidade Salesforce São Paulo - Desmistificando o Omnistudio (Vlocity)
20250228 LYD VKU AI Blended-Learning.pptx
Review of recent advances in non-invasive hemoglobin estimation
Transforming Manufacturing operations through Intelligent Integrations
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
Cloud computing and distributed systems.
Per capita expenditure prediction using model stacking based on satellite ima...
Spectral efficient network and resource selection model in 5G networks
Dropbox Q2 2025 Financial Results & Investor Presentation
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
Modernizing your data center with Dell and AMD
AI And Its Effect On The Evolving IT Sector In Australia - Elevate
Big Data Technologies - Introduction.pptx
NewMind AI Weekly Chronicles - August'25 Week I
CIFDAQ's Market Wrap: Ethereum Leads, Bitcoin Lags, Institutions Shift

JSON and REST

  • 1. The New Kids on the Data Block JSON and REST
  • 2. RESTWhat does it stand for?: Representational StateTransfer What Is it?A style of software architecture for distributed systemsWho/Where/When? Came about in 2000 doctoral dissertation of Roy Fielding – but it’s been used for much longer
  • 3. REST – Core Principal
  • 4. REST – Where/How: Simple ExamplePremise: Data in a table could be a resource we want to read Database server called bbddb01Database called northwindTable called usershttp://bbddb01/northwind/users
  • 5. What, What, What?What type of content you return is up to you.Compare to SOAP where you must return XML.Most common are XML or JSON. You could return complex types like a picture.
  • 6. REST – Is it used?Web sites are RESTfulRSS is RESTfulTwitter, Flickr and Amazon expose data using RESTSome things are “accidentally RESTful” in that they offer limited support.
  • 7. Real Life: Flickr APIResource: PhotosWhere:http://farm{farm-id}.static.flickr.com/{server-id}/{id}_{secret}.jpg
  • 9. http://farm{farm-id}.static.flickr.com/{server-id}/{id}_{o-secret}_o.(jpg|gif|png)What: JPEG, GIF or PNG (defined in the URL)http://farm1.static.flickr.com/2/1418878_1e92283336_m.jpg
  • 10. REST – MethodsHTTP Methods are a key corner stone in REST. They define the action to be taken with a URL.Proper RESTful services expose all four – “accidental” expose less.Nothing stopping you doing some Mix & MatchSome URL’s offering all of them and others a limited setWhat are the four methods and what should they do?
  • 11. REST – Methods Examplehttp://bbddb01/northwind/users[firstname=“rob%”]+ POST = Error + GET = Returns everyone who begins with rob+ PUT = Error+ DELETE = Deletes everyone who begins with robhttp://bbddb01/northwind/users& we add some input data+ POST = Creates a new user+ GET = Returns everyone who meets criteria+ PUT = Creates/Updates a user (based on data)+ DELETE = Deletes everyone who meets criteria
  • 12. REST – Methods Examplehttp://bbddb01/northwind/users[firstname=“rob%”]+ POST = Error + PUT = ErrorWhat would the error be?HTTP 400 or 500 errors are normally used to indicate problems – same as websites
  • 13. REST – CommandsYou can associate commands with a resource. Commands can replace the need for using HTTP methods and can provide a more familiar way of dealing with data.Example:userResource = new Resource('http://example.com/users/001') userResource.delete()
  • 14. Comparing apples and orangesFIGHT: REST vs. SOAP
  • 15. REST vs. SOAP – pt I: Technology
  • 16. REST vs. SOAP – pt II: Languages
  • 17. REST vs. SOAP – pt III: Tools
  • 18. FAQ about Security?Are RESTful services secure? It’s a style, not a technology so that depends on how you implement it.Are you open to SQL injection attacks?When you look at http://bbddb01/northwind/users[firstname=“rob%”], you may think so but you shouldn’t be. Because:The parameter shouldn’t be SQLIf it is SQL, why are you not filtering it?Remember the old rule: Do not trust user input
  • 19. FAQ about Security?How can I do authentication?It’s built on HTTP, so everything you have for authentication in HTTP is availablePLUSYou could encode your authentication requirements into the input fields
  • 20. DEMOBuilding a RESTful database with ADO.NET Data Services
  • 21. JSON – What is it?“JSON (JavaScript Object Notation) is a lightweight data-interchange format. It is easy for humans to read and write. It is easy for machines to parse and generate” – JSON.orgImportantly: JSON is a subset of JavaScript
  • 22. JSON – What does it look like?{"firstName": "John","lastName": "Smith","address": {"streetAddress": "21 2nd Street","city": "New York","state": "NY","postalCode": 10021},"phoneNumbers": ["212 555-1234","646 555-4567"]}Name/Value PairsChild propertiesNumber data typeString Array
  • 26. More on jQuery?What: jQuery TRWho: ReinWhere: BB&D CollabWhen: 20th May 2009
  • 27. Aren’t they the same?FIGHT: JSON vs XML
  • 29. JSON vs. XML which to use?Scenario 1: You have a website (say Twitter.com) and you want to expose a public API to build apps.
  • 30. JSON vs. XML which to use?Scenario 2: You have a website (say gmail.com) and your front end needs to show entries from a mailbox, but needs to be dynamic and so you will use a lot of JavaScript.
  • 31. JSON vs. XMLWhich of them should you use? Use Both – They both have strengths and weaknesses and you need to identify when one is stronger than the other.