SlideShare a Scribd company logo
External Data Access With jQuery and AJAX Doncho Minkov Telerik Mobile Development Course mobiledevcourse.telerik.com Technical Trainer http://www.minkov.it
Table of Contents RESTful Web Services XML, JSON, RSS Consuming REST with jQuery Consuming Twitter REST with jQuery Twitter @Anywhere Twitter @Anywhere Features Facebook API
RESTful Web Services Lightweight Architecture for Web Services
What is REST? "Representational state transfer (REST) is a style of software architecture for distributed hypermedia systems such as the World Wide Web." http://en.wikipedia.org/wiki/Representational_State_Transfer Application state and functionality are resources  Every resource has an URI All resources share a uniform interface This natively maps to the HTTP protocol
RESTful Services One URI for a resource, multiple operations Add a new document "RestTalk" in category "Code" PUT  http :// mysite.com/docs/Code/RestTalk Get the document / some page GET  http :// mysite.com/docs/Code/RestTalk GET  http:// mysite.com/docs/Code/RestTalk/pages/3 Remove the document DELETE  http :// mysite.com/docs/Code/RestTalk Retrieve metadata HEAD  http :// mysite.com/docs/Code/RestTalk
XML, JSON, RSS Comparing the Common Service Data Formats
XML XML is markup-language for encoding documents in machine-readable form Text-based format Consists of tags, attributes and content Provide data and meta-data in the same time <?xml version=&quot;1.0&quot;?> <library> <book><title>HTML 5</title><author>Bay Ivan</author></book> <book><title>WPF 4</title><author>Microsoft</author></book> <book><title>WCF 4</title><author>Kaka Mara</author></book> <book><title>UML 2.0</title><author>Bay Ali</author></book> </library>
JSON JSON (JavaScript Object Notation) Standard for representing simple data structures  and associative arrays Lightweight text-based open standard Derived from the JavaScript language  { &quot;firstName&quot;: &quot;John&quot;, &quot;lastName&quot;: &quot;Smith&quot;, &quot;age&quot;: 25, &quot;address&quot;: { &quot;streetAddress&quot;: &quot;33 Alex. Malinov Blvd.&quot;, &quot;city&quot;: &quot;Sofia&quot;, &quot;postalCode&quot;: &quot;10021&quot; }, &quot;phoneNumber&quot;: [{ &quot;type&quot;: &quot;home&quot;, &quot;number&quot;: &quot;212 555-1234&quot;}, { &quot;type&quot;: &quot;fax&quot;, &quot;number&quot;: &quot;646 555-4567&quot; }] }, { &quot;firstName&quot;: &quot;Bay&quot;, &quot;lastName&quot;: &quot;Ivan&quot;, &quot;age&quot;: 79 }
RSS RSS (Really Simple Syndication) Family of Web feed formats for  publishing frequently updated works E.g. blog entries, news headlines, videos, etc. Based on XML, with standardized XSD schema RSS documents (feeds) are list of items Each containing title, author, publish date, summarized text, and metadata Atom protocol aimed to enhance / replace RSS
RSS – Example <?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot; ?> <rss version=&quot;2.0&quot;> <channel> <title>W3Schools Home Page</title> <link>http://www.w3schools.com</link> <description>Free web building tutorials</description> <item> <title>RSS Tutorial</title> <link>http://www.w3schools.com/rss</link> <description>New RSS tutorial on W3Schools</description> </item> <item> <title>XML Tutorial</title> <link>http://www.w3schools.com/xml</link> <description>New XML tutorial on W3Schools</description> </item> </channel> </rss>
Consuming REST  with jQuery How To Make It Work?
Consuming REST With jQuery Can be done with three methods $.ajax(…) $.get(…) $.post(…) $.get(…)  and  $.post(…)  use  $.ajax(…)  under the hood These methods load data from the server Using rest service Return JSON, Atom, RSS
Example of $.ajax(…) $.ajax({ url: &quot;RestService.svc/students/all&quot;, type: &quot;GET&quot;,  timeout: 5000,  dataType: &quot;json&quot;, success: function (students) { $('#loadStudentsButton').html(&quot;students loaded&quot;); // do something with the students data // visualize them, etc… } error: function (err) { $('#loadStudentsButton').html(&quot;error: &quot; + err.status); } }); The path of the REST Service (should be on the same server) Request type ('GET' or 'POST') The type of data to expect(JSON,XML) In case the request is successful In case the request is unsuccessful Example of  jQuery.ajax(…)  get request
Example of $.ajax(…) $.ajax({ url: &quot;RestService.svc/students/new&quot;, type: &quot;POST&quot;, timeout: 5000, contentType: &quot;application/json&quot;, data: JSON.stringify(student), success: function () { $('#createStudentButton').html(&quot;student created&quot;); //reload the students }, error: function (err) { $('#createStudentButton').html(&quot;error: &quot; + err.status); } }); The type of data to sent  to the server (JSON, XML) We have a student object (in JSON) and should make it readable for the server Example of  jQuery.ajax(…)  post request
Consuming Our REST  with jQuery Live Demo
Consuming Twitter REST  with jQuery Lets Make Our Own Twitter?
Twitter Rest API First lets get familiar with the  Twitter REST API We are given a set of methods to Get a number of tweets for a given user Post a tweet using jQuery Search tweets Etc… First need to register a twitter app
Twitter Rest API (2) Registering a Twitter App Go to  http://dev.twitter.com Register a App When your app is registered you get: Consumer key The key your app authorizes with Consumer secret Used for user authentication
Methods of Twitter REST API GET  statuses/user_timeline Returns the 20 most recent statuses posted by the authenticating user It is also possible to request another user's timeline by using  The  screen_name  or  user_id  parameter The other users timeline will only be visible if they are not protected If the authenticating user's follow request was
Example of $.ajax(…) $.ajax({ url : https://twitter.com/statuses/user_timeline/&quot;+ user+&quot;.json?callback=?&quot; dataType : &quot;json&quot;,  timeout:5000,  success : function(data) { //Visualize Tweets }, error : function() {    //Visualize Errors },  });  Getting  Tweets  from  Twitter  with  jQuery
Tweets Live Demo
Twitter @Anywhere How To Make It Easy?
What is  Twitter @Anywhere ? An easy-to-deploy solution Bringing the Twitter communication platform Promotes a more engaged user base Can be used to add  Follow   Buttons ,  Hovercards ,  linkify Twitter   usernames Build integrations with &quot; Connect to Twitter &quot; Example of $.ajax(…)
How to Use @Anywhere? With a registered App at  dev.twitter.com  You get a  AppId In the  head  part of the app include With  anywhere.js  included A  twttr  object and an  anywhere   function Used to make the magic with anywhere <script src=&quot;http://platform.twitter.com/ anywhere.js?id=YOUR_APP_ID&v=1&quot;></script>
@Anywhere Example Live Demos
Search Widget new TWTR.Widget({ version: 2, type: ' search ', search: , interval: 300,  title: 'It\'s a double rainbow', subject: 'Across the sky', width: 250, height: 300,  theme: {   shell: {background:'# 70fd90 ',color: '# 000000 '},   tweets: {background: '# c6fec7 ', color: '# 444444 ', links: '# 1985b5 '} }, features: { scrollbar: true, loop: true, live: true, behavior: 'default'   } }).render().start();
Tweets List Widget new TWTR.Widget({ version: 2, type: ' profile ', search: , interval: 300,  title: 'It\'s a double rainbow', subject: 'Across the sky', width: 250, height: 300,  theme: {   shell: {background:'# 70fd90 ',color: '# 000000 '},   tweets: {background: '# c6fec7 ', color: '# 444444 ', links: '# 1985b5 '} }, features: { scrollbar: true, loop: true, live: true, behavior: 'default'   } }).render().start();
Twitter Widgets Live Demo
Twitter @Anywhere Features Login/Logout, Tweet, etc.
Login – Logout twttr.anywhere(function (T) { T(&quot;#login&quot;).connectButton({   authComplete: function(user) { //something to do after authentication   }, }); }); Login: function logOut() {   twttr.anywhere.signOut(); } Logout
Login/Logout Live Demo
Features Tweet Box twttr.anywhere(function (T) { T(&quot;#tbox&quot;).tweetBox(); }); Follow Button twttr.anywhere(function (T) { T('#follow-donchominkov').followButton(&quot;donchominkov&quot;); });
Twitter @Anywhere Live Demo
Facebook API Lets Play a Little with Facebook
Facebook JavaScript SDK Facebook provides a SDK for JavaScript To use the functionality of Facebook Should register an app Through phone number With credit card Absolutely free Made for precautions
Facebook API Live Demo
External Data Access

More Related Content

PPTX
Design Beautiful REST + JSON APIs
PPT
Understanding REST
ODP
The Internet as Web Services: introduction to ReST
PPTX
Rest presentation
PPTX
Best practices for RESTful web service design
PDF
Rest web services
PDF
Best Practices in Web Service Design
PDF
REST, RESTful API
Design Beautiful REST + JSON APIs
Understanding REST
The Internet as Web Services: introduction to ReST
Rest presentation
Best practices for RESTful web service design
Rest web services
Best Practices in Web Service Design
REST, RESTful API

What's hot (20)

PPTX
Creating Truly RESTful APIs
PDF
The never-ending REST API design debate
PDF
Restful Web Services
PDF
What is REST API? REST API Concepts and Examples | Edureka
KEY
Rest and the hypermedia constraint
PDF
Representational State Transfer (REST) and HATEOAS
PPTX
RESTful API Design Fundamentals
PPTX
Understanding REST APIs in 5 Simple Steps
PDF
The never-ending REST API design debate -- Devoxx France 2016
PPTX
PPTX
PDF
Building Beautiful REST APIs in ASP.NET Core
PPTX
Introduction To REST
PPTX
Restful webservices
PDF
How to build a rest api.pptx
PDF
Together Cheerfully to Walk with Hypermedia
PPTX
Elegant Rest Design Webinar
PPT
SOA and web services
PPTX
Rest and Rails
PPT
Rest in Rails
Creating Truly RESTful APIs
The never-ending REST API design debate
Restful Web Services
What is REST API? REST API Concepts and Examples | Edureka
Rest and the hypermedia constraint
Representational State Transfer (REST) and HATEOAS
RESTful API Design Fundamentals
Understanding REST APIs in 5 Simple Steps
The never-ending REST API design debate -- Devoxx France 2016
Building Beautiful REST APIs in ASP.NET Core
Introduction To REST
Restful webservices
How to build a rest api.pptx
Together Cheerfully to Walk with Hypermedia
Elegant Rest Design Webinar
SOA and web services
Rest and Rails
Rest in Rails
Ad

Similar to External Data Access with jQuery (20)

ODP
Interoperable Web Services with JAX-WS
PDF
JSON and the APInauts
PPT
Zend framework 05 - ajax, json and j query
PPT
Sencha Touch Intro
PPT
Lecture 3 - Comm Lab: Web @ ITP
ODP
Architecting Web Services
PPT
Eugene Andruszczenko: jQuery
PPT
jQuery Presentation - Refresh Events
PPT
Embedded Typesafe Domain Specific Languages for Java
PDF
Merb jQuery
PPTX
Designing CakePHP plugins for consuming APIs
PPT
Apache Camel - WJax 2008
PPT
Introduction to Prototype JS Framework
PPTX
Internet protocalls & WCF/DReAM
PPT
Getting the Most Out of OpenSocial Gadgets
PPTX
SgCodeJam24 Workshop Extract
PPT
Introduction to JQuery
ODP
Satellite Apps around the Cloud: Integrating your infrastructure with JIRA St...
ODP
Summit2011 satellites-robinf-20110605
ODP
REST dojo Comet
Interoperable Web Services with JAX-WS
JSON and the APInauts
Zend framework 05 - ajax, json and j query
Sencha Touch Intro
Lecture 3 - Comm Lab: Web @ ITP
Architecting Web Services
Eugene Andruszczenko: jQuery
jQuery Presentation - Refresh Events
Embedded Typesafe Domain Specific Languages for Java
Merb jQuery
Designing CakePHP plugins for consuming APIs
Apache Camel - WJax 2008
Introduction to Prototype JS Framework
Internet protocalls & WCF/DReAM
Getting the Most Out of OpenSocial Gadgets
SgCodeJam24 Workshop Extract
Introduction to JQuery
Satellite Apps around the Cloud: Integrating your infrastructure with JIRA St...
Summit2011 satellites-robinf-20110605
REST dojo Comet
Ad

More from Doncho Minkov (20)

PDF
Web Design Concepts
PPT
Web design Tools
PPT
PPT
HTML 5 Tables and Forms
PPT
CSS Overview
PPT
CSS Presentation
PPT
CSS Layout
PPT
PPT
Adobe Photoshop
PPT
Slice and Dice
PPT
Introduction to XAML and WPF
PPT
WPF Layout Containers
PPT
WPF Controls
PPT
WPF Templating and Styling
PPT
WPF Graphics and Animations
PPT
Simple Data Binding
PPT
Complex Data Binding
PPT
WPF Concepts
PPT
Model View ViewModel
PPT
WPF and Databases
Web Design Concepts
Web design Tools
HTML 5 Tables and Forms
CSS Overview
CSS Presentation
CSS Layout
Adobe Photoshop
Slice and Dice
Introduction to XAML and WPF
WPF Layout Containers
WPF Controls
WPF Templating and Styling
WPF Graphics and Animations
Simple Data Binding
Complex Data Binding
WPF Concepts
Model View ViewModel
WPF and Databases

Recently uploaded (20)

PDF
Machine learning based COVID-19 study performance prediction
PDF
solutions_manual_-_materials___processing_in_manufacturing__demargo_.pdf
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PPTX
Big Data Technologies - Introduction.pptx
PDF
KodekX | Application Modernization Development
PPTX
MYSQL Presentation for SQL database connectivity
PDF
GamePlan Trading System Review: Professional Trader's Honest Take
PDF
cuic standard and advanced reporting.pdf
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
PDF
Spectral efficient network and resource selection model in 5G networks
PPTX
breach-and-attack-simulation-cybersecurity-india-chennai-defenderrabbit-2025....
PDF
Network Security Unit 5.pdf for BCA BBA.
PDF
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PDF
Review of recent advances in non-invasive hemoglobin estimation
PPTX
Cloud computing and distributed systems.
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PDF
Transforming Manufacturing operations through Intelligent Integrations
Machine learning based COVID-19 study performance prediction
solutions_manual_-_materials___processing_in_manufacturing__demargo_.pdf
20250228 LYD VKU AI Blended-Learning.pptx
Big Data Technologies - Introduction.pptx
KodekX | Application Modernization Development
MYSQL Presentation for SQL database connectivity
GamePlan Trading System Review: Professional Trader's Honest Take
cuic standard and advanced reporting.pdf
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
Spectral efficient network and resource selection model in 5G networks
breach-and-attack-simulation-cybersecurity-india-chennai-defenderrabbit-2025....
Network Security Unit 5.pdf for BCA BBA.
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
Diabetes mellitus diagnosis method based random forest with bat algorithm
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
Review of recent advances in non-invasive hemoglobin estimation
Cloud computing and distributed systems.
Per capita expenditure prediction using model stacking based on satellite ima...
Dropbox Q2 2025 Financial Results & Investor Presentation
Transforming Manufacturing operations through Intelligent Integrations

External Data Access with jQuery

  • 1. External Data Access With jQuery and AJAX Doncho Minkov Telerik Mobile Development Course mobiledevcourse.telerik.com Technical Trainer http://www.minkov.it
  • 2. Table of Contents RESTful Web Services XML, JSON, RSS Consuming REST with jQuery Consuming Twitter REST with jQuery Twitter @Anywhere Twitter @Anywhere Features Facebook API
  • 3. RESTful Web Services Lightweight Architecture for Web Services
  • 4. What is REST? &quot;Representational state transfer (REST) is a style of software architecture for distributed hypermedia systems such as the World Wide Web.&quot; http://en.wikipedia.org/wiki/Representational_State_Transfer Application state and functionality are resources Every resource has an URI All resources share a uniform interface This natively maps to the HTTP protocol
  • 5. RESTful Services One URI for a resource, multiple operations Add a new document &quot;RestTalk&quot; in category &quot;Code&quot; PUT http :// mysite.com/docs/Code/RestTalk Get the document / some page GET http :// mysite.com/docs/Code/RestTalk GET http:// mysite.com/docs/Code/RestTalk/pages/3 Remove the document DELETE http :// mysite.com/docs/Code/RestTalk Retrieve metadata HEAD http :// mysite.com/docs/Code/RestTalk
  • 6. XML, JSON, RSS Comparing the Common Service Data Formats
  • 7. XML XML is markup-language for encoding documents in machine-readable form Text-based format Consists of tags, attributes and content Provide data and meta-data in the same time <?xml version=&quot;1.0&quot;?> <library> <book><title>HTML 5</title><author>Bay Ivan</author></book> <book><title>WPF 4</title><author>Microsoft</author></book> <book><title>WCF 4</title><author>Kaka Mara</author></book> <book><title>UML 2.0</title><author>Bay Ali</author></book> </library>
  • 8. JSON JSON (JavaScript Object Notation) Standard for representing simple data structures and associative arrays Lightweight text-based open standard Derived from the JavaScript language { &quot;firstName&quot;: &quot;John&quot;, &quot;lastName&quot;: &quot;Smith&quot;, &quot;age&quot;: 25, &quot;address&quot;: { &quot;streetAddress&quot;: &quot;33 Alex. Malinov Blvd.&quot;, &quot;city&quot;: &quot;Sofia&quot;, &quot;postalCode&quot;: &quot;10021&quot; }, &quot;phoneNumber&quot;: [{ &quot;type&quot;: &quot;home&quot;, &quot;number&quot;: &quot;212 555-1234&quot;}, { &quot;type&quot;: &quot;fax&quot;, &quot;number&quot;: &quot;646 555-4567&quot; }] }, { &quot;firstName&quot;: &quot;Bay&quot;, &quot;lastName&quot;: &quot;Ivan&quot;, &quot;age&quot;: 79 }
  • 9. RSS RSS (Really Simple Syndication) Family of Web feed formats for publishing frequently updated works E.g. blog entries, news headlines, videos, etc. Based on XML, with standardized XSD schema RSS documents (feeds) are list of items Each containing title, author, publish date, summarized text, and metadata Atom protocol aimed to enhance / replace RSS
  • 10. RSS – Example <?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot; ?> <rss version=&quot;2.0&quot;> <channel> <title>W3Schools Home Page</title> <link>http://www.w3schools.com</link> <description>Free web building tutorials</description> <item> <title>RSS Tutorial</title> <link>http://www.w3schools.com/rss</link> <description>New RSS tutorial on W3Schools</description> </item> <item> <title>XML Tutorial</title> <link>http://www.w3schools.com/xml</link> <description>New XML tutorial on W3Schools</description> </item> </channel> </rss>
  • 11. Consuming REST with jQuery How To Make It Work?
  • 12. Consuming REST With jQuery Can be done with three methods $.ajax(…) $.get(…) $.post(…) $.get(…) and $.post(…) use $.ajax(…) under the hood These methods load data from the server Using rest service Return JSON, Atom, RSS
  • 13. Example of $.ajax(…) $.ajax({ url: &quot;RestService.svc/students/all&quot;, type: &quot;GET&quot;, timeout: 5000, dataType: &quot;json&quot;, success: function (students) { $('#loadStudentsButton').html(&quot;students loaded&quot;); // do something with the students data // visualize them, etc… } error: function (err) { $('#loadStudentsButton').html(&quot;error: &quot; + err.status); } }); The path of the REST Service (should be on the same server) Request type ('GET' or 'POST') The type of data to expect(JSON,XML) In case the request is successful In case the request is unsuccessful Example of jQuery.ajax(…) get request
  • 14. Example of $.ajax(…) $.ajax({ url: &quot;RestService.svc/students/new&quot;, type: &quot;POST&quot;, timeout: 5000, contentType: &quot;application/json&quot;, data: JSON.stringify(student), success: function () { $('#createStudentButton').html(&quot;student created&quot;); //reload the students }, error: function (err) { $('#createStudentButton').html(&quot;error: &quot; + err.status); } }); The type of data to sent to the server (JSON, XML) We have a student object (in JSON) and should make it readable for the server Example of jQuery.ajax(…) post request
  • 15. Consuming Our REST with jQuery Live Demo
  • 16. Consuming Twitter REST with jQuery Lets Make Our Own Twitter?
  • 17. Twitter Rest API First lets get familiar with the Twitter REST API We are given a set of methods to Get a number of tweets for a given user Post a tweet using jQuery Search tweets Etc… First need to register a twitter app
  • 18. Twitter Rest API (2) Registering a Twitter App Go to http://dev.twitter.com Register a App When your app is registered you get: Consumer key The key your app authorizes with Consumer secret Used for user authentication
  • 19. Methods of Twitter REST API GET statuses/user_timeline Returns the 20 most recent statuses posted by the authenticating user It is also possible to request another user's timeline by using The screen_name or user_id parameter The other users timeline will only be visible if they are not protected If the authenticating user's follow request was
  • 20. Example of $.ajax(…) $.ajax({ url : https://twitter.com/statuses/user_timeline/&quot;+ user+&quot;.json?callback=?&quot; dataType : &quot;json&quot;, timeout:5000, success : function(data) { //Visualize Tweets }, error : function() { //Visualize Errors }, }); Getting Tweets from Twitter with jQuery
  • 22. Twitter @Anywhere How To Make It Easy?
  • 23. What is Twitter @Anywhere ? An easy-to-deploy solution Bringing the Twitter communication platform Promotes a more engaged user base Can be used to add Follow Buttons , Hovercards , linkify Twitter usernames Build integrations with &quot; Connect to Twitter &quot; Example of $.ajax(…)
  • 24. How to Use @Anywhere? With a registered App at dev.twitter.com You get a AppId In the head part of the app include With anywhere.js included A twttr object and an anywhere function Used to make the magic with anywhere <script src=&quot;http://platform.twitter.com/ anywhere.js?id=YOUR_APP_ID&v=1&quot;></script>
  • 26. Search Widget new TWTR.Widget({ version: 2, type: ' search ', search: , interval: 300, title: 'It\'s a double rainbow', subject: 'Across the sky', width: 250, height: 300, theme: { shell: {background:'# 70fd90 ',color: '# 000000 '}, tweets: {background: '# c6fec7 ', color: '# 444444 ', links: '# 1985b5 '} }, features: { scrollbar: true, loop: true, live: true, behavior: 'default' } }).render().start();
  • 27. Tweets List Widget new TWTR.Widget({ version: 2, type: ' profile ', search: , interval: 300, title: 'It\'s a double rainbow', subject: 'Across the sky', width: 250, height: 300, theme: { shell: {background:'# 70fd90 ',color: '# 000000 '}, tweets: {background: '# c6fec7 ', color: '# 444444 ', links: '# 1985b5 '} }, features: { scrollbar: true, loop: true, live: true, behavior: 'default' } }).render().start();
  • 29. Twitter @Anywhere Features Login/Logout, Tweet, etc.
  • 30. Login – Logout twttr.anywhere(function (T) { T(&quot;#login&quot;).connectButton({ authComplete: function(user) { //something to do after authentication }, }); }); Login: function logOut() { twttr.anywhere.signOut(); } Logout
  • 32. Features Tweet Box twttr.anywhere(function (T) { T(&quot;#tbox&quot;).tweetBox(); }); Follow Button twttr.anywhere(function (T) { T('#follow-donchominkov').followButton(&quot;donchominkov&quot;); });
  • 34. Facebook API Lets Play a Little with Facebook
  • 35. Facebook JavaScript SDK Facebook provides a SDK for JavaScript To use the functionality of Facebook Should register an app Through phone number With credit card Absolutely free Made for precautions