SlideShare a Scribd company logo
1 of 27
The New Kids on the Data Block 		JSON 		and		REST
REST What does it stand for?:  	Representational StateTransfer  What Is it? A style of software architecture for distributed systems Who/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 Example Premise:  Data in a table could be a resource we want to read 	Database server called  bbddb01 Database called northwind Table called users http://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 RESTful RSS is RESTful Twitter, Flickr and Amazon expose data using REST Some things are “accidentally RESTful” in that they offer limited support.
Real Life: Flickr API Resource: Photos Where: ,[object Object]
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 – Methods HTTP 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 & Match ,[object Object],What are the four methods and what should they do?
REST – Methods Example http://bbddb01/northwind/users[firstname=“rob%”] + POST = Error  + GET = Returns everyone who begins with rob + PUT = Error + DELETE = Deletes everyone who begins with rob http://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 Example http://bbddb01/northwind/users[firstname=“rob%”] + POST = Error  + PUT = Error What would the error be? HTTP 400 or 500 errors are normally used to indicate problems – same as websites
REST – Commands You 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 oranges FIGHT: 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 SQL If 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 available PLUS You could encode your authentication requirements into the input fields
DEMO Building 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.org Importantly: 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 Pairs Child properties Number data type String Array
JSON Data Structures
Demo JSON Basics
ADO.NET Data Services & JSON Demo
More on jQuery? What: jQuery TR Who: Rein Where: BB&D Collab When: 20th May 2009
Aren’t they the same? FIGHT: JSON vs XML

More Related Content

What's hot

What's hot (20)

Introduction to PHP
Introduction to PHPIntroduction to PHP
Introduction to PHP
 
Intro to beautiful soup
Intro to beautiful soupIntro to beautiful soup
Intro to beautiful soup
 
Full Stack Web Developer (MERN STACK Developer.pptx
Full Stack Web Developer (MERN STACK Developer.pptxFull Stack Web Developer (MERN STACK Developer.pptx
Full Stack Web Developer (MERN STACK Developer.pptx
 
Introduction to Web Scraping using Python and Beautiful Soup
Introduction to Web Scraping using Python and Beautiful SoupIntroduction to Web Scraping using Python and Beautiful Soup
Introduction to Web Scraping using Python and Beautiful Soup
 
Php Presentation
Php PresentationPhp Presentation
Php Presentation
 
01 Php Introduction
01 Php Introduction01 Php Introduction
01 Php Introduction
 
Controls
ControlsControls
Controls
 
Web application architecture
Web application architectureWeb application architecture
Web application architecture
 
Json
JsonJson
Json
 
Get and post methods
Get and post methodsGet and post methods
Get and post methods
 
Arrays in PHP
Arrays in PHPArrays in PHP
Arrays in PHP
 
PHP FUNCTIONS
PHP FUNCTIONSPHP FUNCTIONS
PHP FUNCTIONS
 
MYSQL.ppt
MYSQL.pptMYSQL.ppt
MYSQL.ppt
 
Asp.net.
Asp.net.Asp.net.
Asp.net.
 
Js ppt
Js pptJs ppt
Js ppt
 
Javascript essentials
Javascript essentialsJavascript essentials
Javascript essentials
 
Javascript dom event
Javascript dom eventJavascript dom event
Javascript dom event
 
Bootstrap
BootstrapBootstrap
Bootstrap
 
PHP Presentation
PHP PresentationPHP Presentation
PHP Presentation
 
PHP - Introduction to File Handling with PHP
PHP -  Introduction to  File Handling with PHPPHP -  Introduction to  File Handling with PHP
PHP - Introduction to File Handling with PHP
 

Similar to JSON and REST

The Evolving Security Environment For Web Services
The Evolving Security Environment For Web ServicesThe Evolving Security Environment For Web Services
The Evolving Security Environment For Web Services
Qanita Ahmad
 
RESTful services
RESTful servicesRESTful services
RESTful services
gouthamrv
 
Hanoi php day 2008 - 05. nguyen hai nhat huy - building-restful-web-service-w...
Hanoi php day 2008 - 05. nguyen hai nhat huy - building-restful-web-service-w...Hanoi php day 2008 - 05. nguyen hai nhat huy - building-restful-web-service-w...
Hanoi php day 2008 - 05. nguyen hai nhat huy - building-restful-web-service-w...
Nguyen Duc Phu
 
Java Script Based Client Server Webapps 2
Java Script Based Client Server Webapps 2Java Script Based Client Server Webapps 2
Java Script Based Client Server Webapps 2
kriszyp
 

Similar to JSON and REST (20)

The Evolving Security Environment For Web Services
The Evolving Security Environment For Web ServicesThe Evolving Security Environment For Web Services
The Evolving Security Environment For Web Services
 
The Internet as Web Services: introduction to ReST
The Internet as Web Services: introduction to ReSTThe Internet as Web Services: introduction to ReST
The Internet as Web Services: introduction to ReST
 
Web services - REST and SOAP
Web services - REST and SOAPWeb services - REST and SOAP
Web services - REST and SOAP
 
RESTful services
RESTful servicesRESTful services
RESTful services
 
Day01 api
Day01   apiDay01   api
Day01 api
 
Phalcon 2 High Performance APIs - DevWeekPOA 2015
Phalcon 2 High Performance APIs - DevWeekPOA 2015Phalcon 2 High Performance APIs - DevWeekPOA 2015
Phalcon 2 High Performance APIs - DevWeekPOA 2015
 
Web services soap and rest by mandakini for TechGig
Web services soap and rest by mandakini for TechGigWeb services soap and rest by mandakini for TechGig
Web services soap and rest by mandakini for TechGig
 
WordPress REST API v2: Overview & Exploring
WordPress REST API v2: Overview & ExploringWordPress REST API v2: Overview & Exploring
WordPress REST API v2: Overview & Exploring
 
Introducing CouchDB
Introducing CouchDBIntroducing CouchDB
Introducing CouchDB
 
working with PHP & DB's
working with PHP & DB'sworking with PHP & DB's
working with PHP & DB's
 
Restful web services
Restful web servicesRestful web services
Restful web services
 
Hanoi php day 2008 - 05. nguyen hai nhat huy - building-restful-web-service-w...
Hanoi php day 2008 - 05. nguyen hai nhat huy - building-restful-web-service-w...Hanoi php day 2008 - 05. nguyen hai nhat huy - building-restful-web-service-w...
Hanoi php day 2008 - 05. nguyen hai nhat huy - building-restful-web-service-w...
 
RESTful design
RESTful designRESTful design
RESTful design
 
Document Databases & RavenDB
Document Databases & RavenDBDocument Databases & RavenDB
Document Databases & RavenDB
 
Switch to Backend 2023
Switch to Backend 2023Switch to Backend 2023
Switch to Backend 2023
 
Helping Things to REST
Helping Things to RESTHelping Things to REST
Helping Things to REST
 
Introduction To REST
Introduction To RESTIntroduction To REST
Introduction To REST
 
Web Services, for DevDays Belfast
Web Services, for DevDays BelfastWeb Services, for DevDays Belfast
Web Services, for DevDays Belfast
 
Java Script Based Client Server Webapps 2
Java Script Based Client Server Webapps 2Java Script Based Client Server Webapps 2
Java Script Based Client Server Webapps 2
 
What is API - Understanding API Simplified
What is API - Understanding API SimplifiedWhat is API - Understanding API Simplified
What is API - Understanding API Simplified
 

More from Robert MacLean

More from Robert MacLean (20)

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

Recently uploaded

IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
Enterprise Knowledge
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
vu2urc
 

Recently uploaded (20)

08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 

JSON and REST

  • 1. The New Kids on the Data Block JSON and REST
  • 2. REST What does it stand for?: Representational StateTransfer What Is it? A style of software architecture for distributed systems Who/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 Example Premise: Data in a table could be a resource we want to read Database server called bbddb01 Database called northwind Table called users http://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 RESTful RSS is RESTful Twitter, Flickr and Amazon expose data using REST Some things are “accidentally RESTful” in that they offer limited support.
  • 7.
  • 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.
  • 11. REST – Methods Example http://bbddb01/northwind/users[firstname=“rob%”] + POST = Error + GET = Returns everyone who begins with rob + PUT = Error + DELETE = Deletes everyone who begins with rob http://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 Example http://bbddb01/northwind/users[firstname=“rob%”] + POST = Error + PUT = Error What would the error be? HTTP 400 or 500 errors are normally used to indicate problems – same as websites
  • 13. REST – Commands You 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 oranges FIGHT: 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 SQL If 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 available PLUS You could encode your authentication requirements into the input fields
  • 20. DEMO Building 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.org Importantly: 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 Pairs Child properties Number data type String Array
  • 25. ADO.NET Data Services & JSON Demo
  • 26. More on jQuery? What: jQuery TR Who: Rein Where: BB&D Collab When: 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. XML Which 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.