/
CS 190 Lecture Notes: Tweeter Project CS 190 Lecture Notes: Tweeter Project

CS 190 Lecture Notes: Tweeter Project - PowerPoint Presentation

alexa-scheidler
alexa-scheidler . @alexa-scheidler
Follow
377 views
Uploaded On 2017-01-22

CS 190 Lecture Notes: Tweeter Project - PPT Presentation

Slide 1 Uniform Resource Locators URLs http localhost8080friendshipscreatemyid100ampuserid200 Scheme Host Name Port Number Hierarchical portion Query CS 190 Lecture Notes Tweeter Project ID: 512445

user 100 amp tweeter 100 user tweeter amp lecture notes project slide 190 http json text tweets ids statuses 2014 oct time

Share:

Link:

Embed:

Download Presentation from below link

Download Presentation The PPT/PDF document "CS 190 Lecture Notes: Tweeter Project" is the property of its rightful owner. Permission is granted to download and print the materials on this web site for personal, non-commercial use only, and to display it on your personal computer provided you do not modify the materials and that you retain all copyright notices contained in the materials. By downloading content from our website, you accept the terms of this agreement.


Presentation Transcript

Slide1

CS 190 Lecture Notes: Tweeter Project

Slide 1

Uniform Resource Locators (URLs)

http://localhost:8080/friendships/create?my_id=100&user_id=200

Scheme

Host Name

Port Number

Hierarchical portion

QuerySlide2

CS 190 Lecture Notes: Tweeter Project

Slide 2

HTTP GET Request

GET /statuses/user_timeline?my_id=100 HTTP/1.1Host: www.example.comUser-Agent: Mozilla/5.0

Accept: text/html, */*Accept-Language: en-usAccept-Charset: ISO-8859-1,utf-8Connection: keep-aliveblank line

URL

Protocol Version

Method

Headers

Body

(empty)Slide3

CS 190 Lecture Notes: Tweeter Project

Slide 3

HTTP Response

HTTP/1.1 200 OKDate: Thu, 24 Jul 2008 17:36:27 GMTServer: Tweeter/1.0

Content-Type: application/json;charset=UTF-8Content-Length:

266blank line{"tweets": [{"id": 20006, "user": 100,

"time": "Mon Oct 27 18:02:57 PDT 2014", "text": "I’m at home now",}, {"id": 20005, "user":

100, "time": "Mon Oct 27 17:33:57 PDT 2014", "text": "Stuck in traffic"}

... ]}

Status

Status Message

Version

Headers

BodySlide4

CS 190 Lecture Notes: Tweeter Project

Slide 4

HTTP POST Request

POST /statuses/update HTTP/1.1Host: www.example.comUser-Agent: Mozilla/5.0Accept: text/html, */*

Accept-Language: en-usAccept-Charset: ISO-8859-1,utf-8Connection: keep-aliveblank linemy_id

=100&status=Stuck%20in%20traffic

URL

Protocol Version

Method

Headers

Body

(form data)

ParametersSlide5

Simple values:

"This is a string"

99.6Arrays:

[14, 32, "California", 1.001]Objects (named properties):{"name": "Alice", "age": 24, "salary": 145000}Nested values:{"name": "Alice", "

gpa": 3.5, "friends": ["Bill", "Carol", "David"]}

CS 190 Lecture Notes: Tweeter ProjectSlide 5

JSON NotationSlide6

POST

/friendships/

create?my_id

=100&user_id=200User 100 becomes a follower of user 200POST /friendships/

destroy?my_id=100&user_id=200User 1

00 is no longer a follower of user 200GET /friends/

ids.json?user_id=100Return ids for all users that user 100 is following:[100, 84, 290, 16

]GET

/followers/ids.json?user_id=100

Return ids for all the users following user 100:[200, 374, 82, 95, 1003]

CS 190 Lecture Notes: Tweeter ProjectSlide 6

Tweeter InterfaceSlide7

POST /statuses/

update?my_id

=100&status=Sleepy

Create a new tweet for user 100GET /statuses/user_timeline.json?my_id=100

&count=20&max_id=25000Return the 20 most recent tweets from user 100(exclude tweets with ids > 25000)

{"tweets": [{"id": 20006, "user": 100,

"time": "Mon Oct 27 18:02:57 PDT 2014", "text": "I’m at home now"},

{"id": 20005, "user": 100,

"time": "Mon Oct 27 17:33:57 PDT 2014", "text": "Stuck in traffic"}

... ]

}CS 190 Lecture Notes: Tweeter Project

Slide 7Tweeter Interface, cont’dSlide8

GET /statuses/

home_timeline.json?my_id

=100

&count=10&max_id=25000Return the 20 most recent tweets from user 100 and all users followed by user 100 (exclude tweets with ids > 25000)

CS 190 Lecture Notes: Tweeter ProjectSlide 8Tweeter Interface, cont’d