SlideShare a Scribd company logo
1 of 13
Introduction to JSON
A walk through Twitter using R
and
Basics of ReST API access using R
By: Kevin J. Smith
Kansas City R-Users Group
Introduction
● Kevin J. Smith – IBM Informix – Automation
Engineer
● Twitter API
● JSON
● ReST
● R httr and jsonlite
Twitter APIs
● Twitter ReST APIs:
https://dev.twitter.com/rest/public
● Step 1: Sign up for an API account –
https://dev.twitter.com
● Create an app for Oauth authentication handles
https://dev.twitter.com/apps
● Oauth: https://dev.twitter.com/oauth
Why JSON
● http://www.json.org/
● JSON is most compared to XML
● JSON is leaner and faster
– Smaller in size. A XML document with the same data is larger
than corresponding JSON document
– Writing and parsing json by humans and machines is faster
● JSON is becoming the defacto object data storage
medium replacing XML.
● JSON, in the database world, allows for unstructured
data to be stored and accessed ex photo metadata
JSON (JavaScript Object Notation)
● Key:Value pairs
– Key – any valid unicode string. Special characters like double
quotes must be escaped.
– Value – Number, String, Boolean, Array, Object, null
– Example “Name”:”Kevin”
● Objects or Documents
– Key:Value pairs enclosed in curly brackets
– Example {“Name”:”Kevin”}
● Collection
– An array of documents
– Example [ { “name”:”Kevin”} ,
{ “name” : “Sheryl”} ,
{“huh?”:”what something different”}]
JSON – Data Types
Value Types Description
Number double- precision floating-point format ie
12.138
String Single or Double quoted unicode with
escaped special characters ie
“Hello ”Kevin” World”
Boolean True or false
Array Square bracketed list of value types
Object Curly bracketed list of key:value types
null empty
JSON Document example:
{ “name” : “kevin”,
“age” : 36.06 ,
“titles” : [ “Dr.” , “Sir.”, “Mr.”, 8284, true ] ,
“offspring_oldest” : { “name” : “son”, “age” : 12.21},
“offspring_all” : [ { “name” : “son”, “age” : 12.21},
{ “name” : “daughter” , “age” : 8.92} ] ,
“greying?” : false,
“status” : null
}
ReST (Representational State
Transfer)
● HTTP vs ReST vs SOAP
● Access Methods: GET, POST, PUT, DELETE,
OPTIONS, HEAD, TRACE, CONNECT and
PATCH
● Headers describes the interaction between the
client and the server
● Body describes the data interchanged between
the client and server
● Special data can be sent in the url as query
parameters: ie ?key:value&key:value and must be
url encoded
R httr
● Oauth comes with the httr package. This
allows for Oauth tokens and secrets to be used
for authenticating a user to a data source
● ReST request
– GET(), POST(), PUT(),...
● JSON reply
– Headers(),cookies(), http_status(), content()
cat(json1)
[{"created_at":["Fri Jul 08 19:35:07 +0000 2016"],"id":
[7.51499876924621e+17],"id_str":["751499876924620800"],"text":["Jupiter's moon,
Ganymede, has more water than the Pacific. https://t.co/RGgVqACgq2
https://t.co/Fguz7rXpBj"],"truncated":[false],"extended_entities":{"media":[{"id":
[7.51499874420548e+17],"id_str":["751499874420547584"],"indices":[[83],
[106]],"media_url":
["http://pbs.twimg.com/media/Cm3dJ3eWYAAPCYZ.jpg"],"media_url_https":
["https://pbs.twimg.com/media/Cm3dJ3eWYAAPCYZ.jpg"],"url":
["https://t.co/Fguz7rXpBj"],"display_url":
["pic.twitter.com/Fguz7rXpBj"],"expanded_url":
["http://twitter.com/ScienceChannel/status/751499876924620800/photo/1"],"type":
["photo"],"sizes":{"medium":{"w":[600],"h":[308],"resize":["fit"]},"large":{"w":[600],"h":
[308],"resize":["fit"]},"thumb":{"w":[150],"h":[150],"resize":["crop"]},"small":{"w":
[600],"h":[308],"resize":["fit"]}}}]},"source":["<a href="http://www.hootsuite.com"
rel="nofollow">Hootsuite</a>"],"in_reply_to_status_id":
{},"in_reply_to_status_id_str":{},"in_reply_to_user_id":{},"in_reply_to_user_id_str":
{},"in_reply_to_screen_name":{},"user":{"id":[16895274],"id_str":["16895274"]},"geo":
{},"coordinates":{},"place":{},"contributors":{},"is_quote_status":[false],"retweet_count":
[8],"favorite_count":[10],"favorited":[false],"retweeted":[false],"possibly_sensitive":
[false],"possibly_sensitive_appealable":[false],"lang":["en"]}]
json2$text
[[1]]
[1] "Jupiter's moon, Ganymede, has more water than the Pacific.
https://t.co/RGgVqACgq2 https://t.co/Fguz7rXpBj"
Conclusion
● Comments?
● Questions?

More Related Content

What's hot

What is JSON? Why use JSON? JSON Types? JSON Helpful Tools?
What is JSON? Why use JSON? JSON Types? JSON Helpful Tools?What is JSON? Why use JSON? JSON Types? JSON Helpful Tools?
What is JSON? Why use JSON? JSON Types? JSON Helpful Tools?codeandyou forums
 
JavaScript Object Notation (JSON)
JavaScript Object Notation (JSON)JavaScript Object Notation (JSON)
JavaScript Object Notation (JSON)BOSS Webtech
 
GEDCOM X - FamilySearch Developers Conference 2014
GEDCOM X - FamilySearch Developers Conference 2014GEDCOM X - FamilySearch Developers Conference 2014
GEDCOM X - FamilySearch Developers Conference 2014Ryan Heaton
 
DH11: Browsing Highly Interconnected Humanities Databases Through Multi-Resul...
DH11: Browsing Highly Interconnected Humanities Databases Through Multi-Resul...DH11: Browsing Highly Interconnected Humanities Databases Through Multi-Resul...
DH11: Browsing Highly Interconnected Humanities Databases Through Multi-Resul...Michele Pasin
 
Devoxx - JSON Validation using JSON Schema and Jackson
Devoxx - JSON Validation using JSON Schema and JacksonDevoxx - JSON Validation using JSON Schema and Jackson
Devoxx - JSON Validation using JSON Schema and Jacksonsrondal
 
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 2kriszyp
 
[DSBW Spring 2010] Unit 10: XML and Web And beyond
[DSBW Spring 2010] Unit 10: XML and Web And beyond[DSBW Spring 2010] Unit 10: XML and Web And beyond
[DSBW Spring 2010] Unit 10: XML and Web And beyondCarles Farré
 
JSON and JSON Schema in Oxygen
JSON and JSON Schema in OxygenJSON and JSON Schema in Oxygen
JSON and JSON Schema in OxygenOctavian Nadolu
 
Дмитрий Красун: Сегодня вы уйдете с новым представлением о REST
Дмитрий Красун: Сегодня вы уйдете с новым представлением о RESTДмитрий Красун: Сегодня вы уйдете с новым представлением о REST
Дмитрий Красун: Сегодня вы уйдете с новым представлением о RESTOleg Poludnenko
 

What's hot (17)

What is JSON? Why use JSON? JSON Types? JSON Helpful Tools?
What is JSON? Why use JSON? JSON Types? JSON Helpful Tools?What is JSON? Why use JSON? JSON Types? JSON Helpful Tools?
What is JSON? Why use JSON? JSON Types? JSON Helpful Tools?
 
JSON
JSONJSON
JSON
 
JSON
JSONJSON
JSON
 
JSON - Quick Overview
JSON - Quick OverviewJSON - Quick Overview
JSON - Quick Overview
 
Json
JsonJson
Json
 
JavaScript Object Notation (JSON)
JavaScript Object Notation (JSON)JavaScript Object Notation (JSON)
JavaScript Object Notation (JSON)
 
Json
JsonJson
Json
 
GEDCOM X - FamilySearch Developers Conference 2014
GEDCOM X - FamilySearch Developers Conference 2014GEDCOM X - FamilySearch Developers Conference 2014
GEDCOM X - FamilySearch Developers Conference 2014
 
Json
JsonJson
Json
 
DH11: Browsing Highly Interconnected Humanities Databases Through Multi-Resul...
DH11: Browsing Highly Interconnected Humanities Databases Through Multi-Resul...DH11: Browsing Highly Interconnected Humanities Databases Through Multi-Resul...
DH11: Browsing Highly Interconnected Humanities Databases Through Multi-Resul...
 
Json Tutorial
Json TutorialJson Tutorial
Json Tutorial
 
Devoxx - JSON Validation using JSON Schema and Jackson
Devoxx - JSON Validation using JSON Schema and JacksonDevoxx - JSON Validation using JSON Schema and Jackson
Devoxx - JSON Validation using JSON Schema and Jackson
 
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
 
[DSBW Spring 2010] Unit 10: XML and Web And beyond
[DSBW Spring 2010] Unit 10: XML and Web And beyond[DSBW Spring 2010] Unit 10: XML and Web And beyond
[DSBW Spring 2010] Unit 10: XML and Web And beyond
 
JSON and JSON Schema in Oxygen
JSON and JSON Schema in OxygenJSON and JSON Schema in Oxygen
JSON and JSON Schema in Oxygen
 
Json
JsonJson
Json
 
Дмитрий Красун: Сегодня вы уйдете с новым представлением о REST
Дмитрий Красун: Сегодня вы уйдете с новым представлением о RESTДмитрий Красун: Сегодня вы уйдете с новым представлением о REST
Дмитрий Красун: Сегодня вы уйдете с новым представлением о REST
 

Viewers also liked

Creating API's with R and plumber
Creating API's with R and plumberCreating API's with R and plumber
Creating API's with R and plumbersellorm
 
Identifying actionable messages on social media
Identifying actionable messages on social mediaIdentifying actionable messages on social media
Identifying actionable messages on social mediaNemanja Spasojevic
 
20130504 - FeWeb - Twitter API
20130504  - FeWeb - Twitter API20130504  - FeWeb - Twitter API
20130504 - FeWeb - Twitter APIPascal Alberty
 
Introduction to JSON & AJAX
Introduction to JSON & AJAXIntroduction to JSON & AJAX
Introduction to JSON & AJAXRaveendra R
 
Introduction to Json ld
Introduction to Json ldIntroduction to Json ld
Introduction to Json ldBo Kai Hsu
 
Twitter API, Streaming and SharePoint 2013
Twitter API, Streaming and SharePoint 2013Twitter API, Streaming and SharePoint 2013
Twitter API, Streaming and SharePoint 2013Sebastian Huppmann
 
Rstudio in aws 16 9
Rstudio in aws 16 9Rstudio in aws 16 9
Rstudio in aws 16 9Tal Galili
 
Combining R With Java For Data Analysis (Devoxx UK 2015 Session)
Combining R With Java For Data Analysis (Devoxx UK 2015 Session)Combining R With Java For Data Analysis (Devoxx UK 2015 Session)
Combining R With Java For Data Analysis (Devoxx UK 2015 Session)Ryan Cuprak
 
Social media analysis in R using twitter API
Social media analysis in R using twitter API Social media analysis in R using twitter API
Social media analysis in R using twitter API Mohd Shadab Alam
 

Viewers also liked (11)

Creating API's with R and plumber
Creating API's with R and plumberCreating API's with R and plumber
Creating API's with R and plumber
 
Identifying actionable messages on social media
Identifying actionable messages on social mediaIdentifying actionable messages on social media
Identifying actionable messages on social media
 
20130504 - FeWeb - Twitter API
20130504  - FeWeb - Twitter API20130504  - FeWeb - Twitter API
20130504 - FeWeb - Twitter API
 
Intro to JSON
Intro to JSONIntro to JSON
Intro to JSON
 
Introduction to JSON & AJAX
Introduction to JSON & AJAXIntroduction to JSON & AJAX
Introduction to JSON & AJAX
 
Introduction to Json ld
Introduction to Json ldIntroduction to Json ld
Introduction to Json ld
 
Twitter API, Streaming and SharePoint 2013
Twitter API, Streaming and SharePoint 2013Twitter API, Streaming and SharePoint 2013
Twitter API, Streaming and SharePoint 2013
 
Rstudio in aws 16 9
Rstudio in aws 16 9Rstudio in aws 16 9
Rstudio in aws 16 9
 
Combining R With Java For Data Analysis (Devoxx UK 2015 Session)
Combining R With Java For Data Analysis (Devoxx UK 2015 Session)Combining R With Java For Data Analysis (Devoxx UK 2015 Session)
Combining R With Java For Data Analysis (Devoxx UK 2015 Session)
 
Json
JsonJson
Json
 
Social media analysis in R using twitter API
Social media analysis in R using twitter API Social media analysis in R using twitter API
Social media analysis in R using twitter API
 

Similar to R-Users Group JSON and ReST Introduction using Twitter

Introducing Azure DocumentDB - NoSQL, No Problem
Introducing Azure DocumentDB - NoSQL, No ProblemIntroducing Azure DocumentDB - NoSQL, No Problem
Introducing Azure DocumentDB - NoSQL, No ProblemAndrew Liu
 
ICONUK 2016: REST Assured, Freeing Your Domino Data Has Never Been That Easy!
ICONUK 2016: REST Assured, Freeing Your Domino Data Has Never Been That Easy!ICONUK 2016: REST Assured, Freeing Your Domino Data Has Never Been That Easy!
ICONUK 2016: REST Assured, Freeing Your Domino Data Has Never Been That Easy!Serdar Basegmez
 
Test Trend Analysis : Towards robust, reliable and timely tests
Test Trend Analysis : Towards robust, reliable and timely testsTest Trend Analysis : Towards robust, reliable and timely tests
Test Trend Analysis : Towards robust, reliable and timely testsHugh McCamphill
 
Document Databases & RavenDB
Document Databases & RavenDBDocument Databases & RavenDB
Document Databases & RavenDBBrian Ritchie
 
Your Database Cannot Do this (well)
Your Database Cannot Do this (well)Your Database Cannot Do this (well)
Your Database Cannot Do this (well)javier ramirez
 
Session 2 - NGSI-LD primer & Smart Data Models | Train the Trainers Program
Session 2 - NGSI-LD primer & Smart Data Models | Train the Trainers ProgramSession 2 - NGSI-LD primer & Smart Data Models | Train the Trainers Program
Session 2 - NGSI-LD primer & Smart Data Models | Train the Trainers ProgramFIWARE
 
Data encoding and Metadata for Streams
Data encoding and Metadata for StreamsData encoding and Metadata for Streams
Data encoding and Metadata for Streamsunivalence
 
No SQL, No Problem: Use Azure DocumentDB
No SQL, No Problem: Use Azure DocumentDBNo SQL, No Problem: Use Azure DocumentDB
No SQL, No Problem: Use Azure DocumentDBKen Cenerelli
 
Brief Introduction to REST
Brief Introduction to RESTBrief Introduction to REST
Brief Introduction to RESTColin Harrington
 
Crafting Evolvable Api Responses
Crafting Evolvable Api ResponsesCrafting Evolvable Api Responses
Crafting Evolvable Api Responsesdarrelmiller71
 
FIWARE Training: JSON-LD and NGSI-LD
FIWARE Training: JSON-LD and NGSI-LDFIWARE Training: JSON-LD and NGSI-LD
FIWARE Training: JSON-LD and NGSI-LDFIWARE
 
R, HTTP, and APIs, with a preview of TopicWatchr
R, HTTP, and APIs, with a preview of TopicWatchrR, HTTP, and APIs, with a preview of TopicWatchr
R, HTTP, and APIs, with a preview of TopicWatchrPortland R User Group
 
"R, HTTP, and APIs, with a preview of TopicWatchr" (15 November 2011)
"R, HTTP, and APIs, with a preview of TopicWatchr" (15 November 2011)"R, HTTP, and APIs, with a preview of TopicWatchr" (15 November 2011)
"R, HTTP, and APIs, with a preview of TopicWatchr" (15 November 2011)Portland R User Group
 
Elephant in the room: A DBA's Guide to Hadoop
Elephant in the room: A DBA's Guide to HadoopElephant in the room: A DBA's Guide to Hadoop
Elephant in the room: A DBA's Guide to HadoopStuart Ainsworth
 
json.ppt download for free for college project
json.ppt download for free for college projectjson.ppt download for free for college project
json.ppt download for free for college projectAmitSharma397241
 
Hypermedia APIs and HATEOAS / Wix Engineering
Hypermedia APIs and HATEOAS / Wix EngineeringHypermedia APIs and HATEOAS / Wix Engineering
Hypermedia APIs and HATEOAS / Wix EngineeringVladimir Tsukur
 

Similar to R-Users Group JSON and ReST Introduction using Twitter (20)

Introducing Azure DocumentDB - NoSQL, No Problem
Introducing Azure DocumentDB - NoSQL, No ProblemIntroducing Azure DocumentDB - NoSQL, No Problem
Introducing Azure DocumentDB - NoSQL, No Problem
 
ICONUK 2016: REST Assured, Freeing Your Domino Data Has Never Been That Easy!
ICONUK 2016: REST Assured, Freeing Your Domino Data Has Never Been That Easy!ICONUK 2016: REST Assured, Freeing Your Domino Data Has Never Been That Easy!
ICONUK 2016: REST Assured, Freeing Your Domino Data Has Never Been That Easy!
 
Advanced Json
Advanced JsonAdvanced Json
Advanced Json
 
Test Trend Analysis : Towards robust, reliable and timely tests
Test Trend Analysis : Towards robust, reliable and timely testsTest Trend Analysis : Towards robust, reliable and timely tests
Test Trend Analysis : Towards robust, reliable and timely tests
 
Document Databases & RavenDB
Document Databases & RavenDBDocument Databases & RavenDB
Document Databases & RavenDB
 
Your Database Cannot Do this (well)
Your Database Cannot Do this (well)Your Database Cannot Do this (well)
Your Database Cannot Do this (well)
 
Session 2 - NGSI-LD primer & Smart Data Models | Train the Trainers Program
Session 2 - NGSI-LD primer & Smart Data Models | Train the Trainers ProgramSession 2 - NGSI-LD primer & Smart Data Models | Train the Trainers Program
Session 2 - NGSI-LD primer & Smart Data Models | Train the Trainers Program
 
Data encoding and Metadata for Streams
Data encoding and Metadata for StreamsData encoding and Metadata for Streams
Data encoding and Metadata for Streams
 
No SQL, No Problem: Use Azure DocumentDB
No SQL, No Problem: Use Azure DocumentDBNo SQL, No Problem: Use Azure DocumentDB
No SQL, No Problem: Use Azure DocumentDB
 
Brief Introduction to REST
Brief Introduction to RESTBrief Introduction to REST
Brief Introduction to REST
 
Switch to Backend 2023
Switch to Backend 2023Switch to Backend 2023
Switch to Backend 2023
 
Crafting Evolvable Api Responses
Crafting Evolvable Api ResponsesCrafting Evolvable Api Responses
Crafting Evolvable Api Responses
 
FIWARE Training: JSON-LD and NGSI-LD
FIWARE Training: JSON-LD and NGSI-LDFIWARE Training: JSON-LD and NGSI-LD
FIWARE Training: JSON-LD and NGSI-LD
 
R, HTTP, and APIs, with a preview of TopicWatchr
R, HTTP, and APIs, with a preview of TopicWatchrR, HTTP, and APIs, with a preview of TopicWatchr
R, HTTP, and APIs, with a preview of TopicWatchr
 
"R, HTTP, and APIs, with a preview of TopicWatchr" (15 November 2011)
"R, HTTP, and APIs, with a preview of TopicWatchr" (15 November 2011)"R, HTTP, and APIs, with a preview of TopicWatchr" (15 November 2011)
"R, HTTP, and APIs, with a preview of TopicWatchr" (15 November 2011)
 
Json at work overview and ecosystem-v2.0
Json at work   overview and ecosystem-v2.0Json at work   overview and ecosystem-v2.0
Json at work overview and ecosystem-v2.0
 
Elephant in the room: A DBA's Guide to Hadoop
Elephant in the room: A DBA's Guide to HadoopElephant in the room: A DBA's Guide to Hadoop
Elephant in the room: A DBA's Guide to Hadoop
 
json.ppt download for free for college project
json.ppt download for free for college projectjson.ppt download for free for college project
json.ppt download for free for college project
 
Sql Data Services
Sql Data ServicesSql Data Services
Sql Data Services
 
Hypermedia APIs and HATEOAS / Wix Engineering
Hypermedia APIs and HATEOAS / Wix EngineeringHypermedia APIs and HATEOAS / Wix Engineering
Hypermedia APIs and HATEOAS / Wix Engineering
 

Recently uploaded

RA-11058_IRR-COMPRESS Do 198 series of 1998
RA-11058_IRR-COMPRESS Do 198 series of 1998RA-11058_IRR-COMPRESS Do 198 series of 1998
RA-11058_IRR-COMPRESS Do 198 series of 1998YohFuh
 
VIP Call Girls in Amravati Aarohi 8250192130 Independent Escort Service Amravati
VIP Call Girls in Amravati Aarohi 8250192130 Independent Escort Service AmravatiVIP Call Girls in Amravati Aarohi 8250192130 Independent Escort Service Amravati
VIP Call Girls in Amravati Aarohi 8250192130 Independent Escort Service AmravatiSuhani Kapoor
 
Best VIP Call Girls Noida Sector 39 Call Me: 8448380779
Best VIP Call Girls Noida Sector 39 Call Me: 8448380779Best VIP Call Girls Noida Sector 39 Call Me: 8448380779
Best VIP Call Girls Noida Sector 39 Call Me: 8448380779Delhi Call girls
 
Industrialised data - the key to AI success.pdf
Industrialised data - the key to AI success.pdfIndustrialised data - the key to AI success.pdf
Industrialised data - the key to AI success.pdfLars Albertsson
 
B2 Creative Industry Response Evaluation.docx
B2 Creative Industry Response Evaluation.docxB2 Creative Industry Response Evaluation.docx
B2 Creative Industry Response Evaluation.docxStephen266013
 
Call Girls in Defence Colony Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Defence Colony Delhi 💯Call Us 🔝8264348440🔝Call Girls in Defence Colony Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Defence Colony Delhi 💯Call Us 🔝8264348440🔝soniya singh
 
Building on a FAIRly Strong Foundation to Connect Academic Research to Transl...
Building on a FAIRly Strong Foundation to Connect Academic Research to Transl...Building on a FAIRly Strong Foundation to Connect Academic Research to Transl...
Building on a FAIRly Strong Foundation to Connect Academic Research to Transl...Jack DiGiovanna
 
VIP Call Girls Service Miyapur Hyderabad Call +91-8250192130
VIP Call Girls Service Miyapur Hyderabad Call +91-8250192130VIP Call Girls Service Miyapur Hyderabad Call +91-8250192130
VIP Call Girls Service Miyapur Hyderabad Call +91-8250192130Suhani Kapoor
 
(PARI) Call Girls Wanowrie ( 7001035870 ) HI-Fi Pune Escorts Service
(PARI) Call Girls Wanowrie ( 7001035870 ) HI-Fi Pune Escorts Service(PARI) Call Girls Wanowrie ( 7001035870 ) HI-Fi Pune Escorts Service
(PARI) Call Girls Wanowrie ( 7001035870 ) HI-Fi Pune Escorts Serviceranjana rawat
 
{Pooja: 9892124323 } Call Girl in Mumbai | Jas Kaur Rate 4500 Free Hotel Del...
{Pooja:  9892124323 } Call Girl in Mumbai | Jas Kaur Rate 4500 Free Hotel Del...{Pooja:  9892124323 } Call Girl in Mumbai | Jas Kaur Rate 4500 Free Hotel Del...
{Pooja: 9892124323 } Call Girl in Mumbai | Jas Kaur Rate 4500 Free Hotel Del...Pooja Nehwal
 
Full night 🥵 Call Girls Delhi New Friends Colony {9711199171} Sanya Reddy ✌️o...
Full night 🥵 Call Girls Delhi New Friends Colony {9711199171} Sanya Reddy ✌️o...Full night 🥵 Call Girls Delhi New Friends Colony {9711199171} Sanya Reddy ✌️o...
Full night 🥵 Call Girls Delhi New Friends Colony {9711199171} Sanya Reddy ✌️o...shivangimorya083
 
Kantar AI Summit- Under Embargo till Wednesday, 24th April 2024, 4 PM, IST.pdf
Kantar AI Summit- Under Embargo till Wednesday, 24th April 2024, 4 PM, IST.pdfKantar AI Summit- Under Embargo till Wednesday, 24th April 2024, 4 PM, IST.pdf
Kantar AI Summit- Under Embargo till Wednesday, 24th April 2024, 4 PM, IST.pdfSocial Samosa
 
Invezz.com - Grow your wealth with trading signals
Invezz.com - Grow your wealth with trading signalsInvezz.com - Grow your wealth with trading signals
Invezz.com - Grow your wealth with trading signalsInvezz1
 
Beautiful Sapna Vip Call Girls Hauz Khas 9711199012 Call /Whatsapps
Beautiful Sapna Vip  Call Girls Hauz Khas 9711199012 Call /WhatsappsBeautiful Sapna Vip  Call Girls Hauz Khas 9711199012 Call /Whatsapps
Beautiful Sapna Vip Call Girls Hauz Khas 9711199012 Call /Whatsappssapnasaifi408
 
Brighton SEO | April 2024 | Data Storytelling
Brighton SEO | April 2024 | Data StorytellingBrighton SEO | April 2024 | Data Storytelling
Brighton SEO | April 2024 | Data StorytellingNeil Barnes
 
PKS-TGC-1084-630 - Stage 1 Proposal.pptx
PKS-TGC-1084-630 - Stage 1 Proposal.pptxPKS-TGC-1084-630 - Stage 1 Proposal.pptx
PKS-TGC-1084-630 - Stage 1 Proposal.pptxPramod Kumar Srivastava
 
Predicting Employee Churn: A Data-Driven Approach Project Presentation
Predicting Employee Churn: A Data-Driven Approach Project PresentationPredicting Employee Churn: A Data-Driven Approach Project Presentation
Predicting Employee Churn: A Data-Driven Approach Project PresentationBoston Institute of Analytics
 
Low Rate Call Girls Bhilai Anika 8250192130 Independent Escort Service Bhilai
Low Rate Call Girls Bhilai Anika 8250192130 Independent Escort Service BhilaiLow Rate Call Girls Bhilai Anika 8250192130 Independent Escort Service Bhilai
Low Rate Call Girls Bhilai Anika 8250192130 Independent Escort Service BhilaiSuhani Kapoor
 

Recently uploaded (20)

RA-11058_IRR-COMPRESS Do 198 series of 1998
RA-11058_IRR-COMPRESS Do 198 series of 1998RA-11058_IRR-COMPRESS Do 198 series of 1998
RA-11058_IRR-COMPRESS Do 198 series of 1998
 
VIP Call Girls in Amravati Aarohi 8250192130 Independent Escort Service Amravati
VIP Call Girls in Amravati Aarohi 8250192130 Independent Escort Service AmravatiVIP Call Girls in Amravati Aarohi 8250192130 Independent Escort Service Amravati
VIP Call Girls in Amravati Aarohi 8250192130 Independent Escort Service Amravati
 
Best VIP Call Girls Noida Sector 39 Call Me: 8448380779
Best VIP Call Girls Noida Sector 39 Call Me: 8448380779Best VIP Call Girls Noida Sector 39 Call Me: 8448380779
Best VIP Call Girls Noida Sector 39 Call Me: 8448380779
 
Industrialised data - the key to AI success.pdf
Industrialised data - the key to AI success.pdfIndustrialised data - the key to AI success.pdf
Industrialised data - the key to AI success.pdf
 
B2 Creative Industry Response Evaluation.docx
B2 Creative Industry Response Evaluation.docxB2 Creative Industry Response Evaluation.docx
B2 Creative Industry Response Evaluation.docx
 
꧁❤ Aerocity Call Girls Service Aerocity Delhi ❤꧂ 9999965857 ☎️ Hard And Sexy ...
꧁❤ Aerocity Call Girls Service Aerocity Delhi ❤꧂ 9999965857 ☎️ Hard And Sexy ...꧁❤ Aerocity Call Girls Service Aerocity Delhi ❤꧂ 9999965857 ☎️ Hard And Sexy ...
꧁❤ Aerocity Call Girls Service Aerocity Delhi ❤꧂ 9999965857 ☎️ Hard And Sexy ...
 
Call Girls in Defence Colony Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Defence Colony Delhi 💯Call Us 🔝8264348440🔝Call Girls in Defence Colony Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Defence Colony Delhi 💯Call Us 🔝8264348440🔝
 
Building on a FAIRly Strong Foundation to Connect Academic Research to Transl...
Building on a FAIRly Strong Foundation to Connect Academic Research to Transl...Building on a FAIRly Strong Foundation to Connect Academic Research to Transl...
Building on a FAIRly Strong Foundation to Connect Academic Research to Transl...
 
VIP Call Girls Service Miyapur Hyderabad Call +91-8250192130
VIP Call Girls Service Miyapur Hyderabad Call +91-8250192130VIP Call Girls Service Miyapur Hyderabad Call +91-8250192130
VIP Call Girls Service Miyapur Hyderabad Call +91-8250192130
 
(PARI) Call Girls Wanowrie ( 7001035870 ) HI-Fi Pune Escorts Service
(PARI) Call Girls Wanowrie ( 7001035870 ) HI-Fi Pune Escorts Service(PARI) Call Girls Wanowrie ( 7001035870 ) HI-Fi Pune Escorts Service
(PARI) Call Girls Wanowrie ( 7001035870 ) HI-Fi Pune Escorts Service
 
{Pooja: 9892124323 } Call Girl in Mumbai | Jas Kaur Rate 4500 Free Hotel Del...
{Pooja:  9892124323 } Call Girl in Mumbai | Jas Kaur Rate 4500 Free Hotel Del...{Pooja:  9892124323 } Call Girl in Mumbai | Jas Kaur Rate 4500 Free Hotel Del...
{Pooja: 9892124323 } Call Girl in Mumbai | Jas Kaur Rate 4500 Free Hotel Del...
 
Full night 🥵 Call Girls Delhi New Friends Colony {9711199171} Sanya Reddy ✌️o...
Full night 🥵 Call Girls Delhi New Friends Colony {9711199171} Sanya Reddy ✌️o...Full night 🥵 Call Girls Delhi New Friends Colony {9711199171} Sanya Reddy ✌️o...
Full night 🥵 Call Girls Delhi New Friends Colony {9711199171} Sanya Reddy ✌️o...
 
Kantar AI Summit- Under Embargo till Wednesday, 24th April 2024, 4 PM, IST.pdf
Kantar AI Summit- Under Embargo till Wednesday, 24th April 2024, 4 PM, IST.pdfKantar AI Summit- Under Embargo till Wednesday, 24th April 2024, 4 PM, IST.pdf
Kantar AI Summit- Under Embargo till Wednesday, 24th April 2024, 4 PM, IST.pdf
 
Invezz.com - Grow your wealth with trading signals
Invezz.com - Grow your wealth with trading signalsInvezz.com - Grow your wealth with trading signals
Invezz.com - Grow your wealth with trading signals
 
Beautiful Sapna Vip Call Girls Hauz Khas 9711199012 Call /Whatsapps
Beautiful Sapna Vip  Call Girls Hauz Khas 9711199012 Call /WhatsappsBeautiful Sapna Vip  Call Girls Hauz Khas 9711199012 Call /Whatsapps
Beautiful Sapna Vip Call Girls Hauz Khas 9711199012 Call /Whatsapps
 
Delhi 99530 vip 56974 Genuine Escort Service Call Girls in Kishangarh
Delhi 99530 vip 56974 Genuine Escort Service Call Girls in  KishangarhDelhi 99530 vip 56974 Genuine Escort Service Call Girls in  Kishangarh
Delhi 99530 vip 56974 Genuine Escort Service Call Girls in Kishangarh
 
Brighton SEO | April 2024 | Data Storytelling
Brighton SEO | April 2024 | Data StorytellingBrighton SEO | April 2024 | Data Storytelling
Brighton SEO | April 2024 | Data Storytelling
 
PKS-TGC-1084-630 - Stage 1 Proposal.pptx
PKS-TGC-1084-630 - Stage 1 Proposal.pptxPKS-TGC-1084-630 - Stage 1 Proposal.pptx
PKS-TGC-1084-630 - Stage 1 Proposal.pptx
 
Predicting Employee Churn: A Data-Driven Approach Project Presentation
Predicting Employee Churn: A Data-Driven Approach Project PresentationPredicting Employee Churn: A Data-Driven Approach Project Presentation
Predicting Employee Churn: A Data-Driven Approach Project Presentation
 
Low Rate Call Girls Bhilai Anika 8250192130 Independent Escort Service Bhilai
Low Rate Call Girls Bhilai Anika 8250192130 Independent Escort Service BhilaiLow Rate Call Girls Bhilai Anika 8250192130 Independent Escort Service Bhilai
Low Rate Call Girls Bhilai Anika 8250192130 Independent Escort Service Bhilai
 

R-Users Group JSON and ReST Introduction using Twitter

  • 1. Introduction to JSON A walk through Twitter using R and Basics of ReST API access using R By: Kevin J. Smith Kansas City R-Users Group
  • 2. Introduction ● Kevin J. Smith – IBM Informix – Automation Engineer ● Twitter API ● JSON ● ReST ● R httr and jsonlite
  • 3. Twitter APIs ● Twitter ReST APIs: https://dev.twitter.com/rest/public ● Step 1: Sign up for an API account – https://dev.twitter.com ● Create an app for Oauth authentication handles https://dev.twitter.com/apps ● Oauth: https://dev.twitter.com/oauth
  • 4.
  • 5.
  • 6. Why JSON ● http://www.json.org/ ● JSON is most compared to XML ● JSON is leaner and faster – Smaller in size. A XML document with the same data is larger than corresponding JSON document – Writing and parsing json by humans and machines is faster ● JSON is becoming the defacto object data storage medium replacing XML. ● JSON, in the database world, allows for unstructured data to be stored and accessed ex photo metadata
  • 7. JSON (JavaScript Object Notation) ● Key:Value pairs – Key – any valid unicode string. Special characters like double quotes must be escaped. – Value – Number, String, Boolean, Array, Object, null – Example “Name”:”Kevin” ● Objects or Documents – Key:Value pairs enclosed in curly brackets – Example {“Name”:”Kevin”} ● Collection – An array of documents – Example [ { “name”:”Kevin”} , { “name” : “Sheryl”} , {“huh?”:”what something different”}]
  • 8. JSON – Data Types Value Types Description Number double- precision floating-point format ie 12.138 String Single or Double quoted unicode with escaped special characters ie “Hello ”Kevin” World” Boolean True or false Array Square bracketed list of value types Object Curly bracketed list of key:value types null empty JSON Document example: { “name” : “kevin”, “age” : 36.06 , “titles” : [ “Dr.” , “Sir.”, “Mr.”, 8284, true ] , “offspring_oldest” : { “name” : “son”, “age” : 12.21}, “offspring_all” : [ { “name” : “son”, “age” : 12.21}, { “name” : “daughter” , “age” : 8.92} ] , “greying?” : false, “status” : null }
  • 9. ReST (Representational State Transfer) ● HTTP vs ReST vs SOAP ● Access Methods: GET, POST, PUT, DELETE, OPTIONS, HEAD, TRACE, CONNECT and PATCH ● Headers describes the interaction between the client and the server ● Body describes the data interchanged between the client and server ● Special data can be sent in the url as query parameters: ie ?key:value&key:value and must be url encoded
  • 10. R httr ● Oauth comes with the httr package. This allows for Oauth tokens and secrets to be used for authenticating a user to a data source ● ReST request – GET(), POST(), PUT(),... ● JSON reply – Headers(),cookies(), http_status(), content()
  • 11.
  • 12. cat(json1) [{"created_at":["Fri Jul 08 19:35:07 +0000 2016"],"id": [7.51499876924621e+17],"id_str":["751499876924620800"],"text":["Jupiter's moon, Ganymede, has more water than the Pacific. https://t.co/RGgVqACgq2 https://t.co/Fguz7rXpBj"],"truncated":[false],"extended_entities":{"media":[{"id": [7.51499874420548e+17],"id_str":["751499874420547584"],"indices":[[83], [106]],"media_url": ["http://pbs.twimg.com/media/Cm3dJ3eWYAAPCYZ.jpg"],"media_url_https": ["https://pbs.twimg.com/media/Cm3dJ3eWYAAPCYZ.jpg"],"url": ["https://t.co/Fguz7rXpBj"],"display_url": ["pic.twitter.com/Fguz7rXpBj"],"expanded_url": ["http://twitter.com/ScienceChannel/status/751499876924620800/photo/1"],"type": ["photo"],"sizes":{"medium":{"w":[600],"h":[308],"resize":["fit"]},"large":{"w":[600],"h": [308],"resize":["fit"]},"thumb":{"w":[150],"h":[150],"resize":["crop"]},"small":{"w": [600],"h":[308],"resize":["fit"]}}}]},"source":["<a href="http://www.hootsuite.com" rel="nofollow">Hootsuite</a>"],"in_reply_to_status_id": {},"in_reply_to_status_id_str":{},"in_reply_to_user_id":{},"in_reply_to_user_id_str": {},"in_reply_to_screen_name":{},"user":{"id":[16895274],"id_str":["16895274"]},"geo": {},"coordinates":{},"place":{},"contributors":{},"is_quote_status":[false],"retweet_count": [8],"favorite_count":[10],"favorited":[false],"retweeted":[false],"possibly_sensitive": [false],"possibly_sensitive_appealable":[false],"lang":["en"]}] json2$text [[1]] [1] "Jupiter's moon, Ganymede, has more water than the Pacific. https://t.co/RGgVqACgq2 https://t.co/Fguz7rXpBj"