CS计算机代考程序代写 Context-aware computing &
Context-aware computing &
Web-based APIs
Mobile and Ubiquitous Computing
Sandy Gould s.gould@cs.bham.ac.uk
22nd February 2021
Presentation
Context-aware computing & Web-based APIs – Sandy Gould, University of Birmingham – 22nd February 2021
Execution
Context-aware computing & Web-based APIs – Sandy Gould, University of Birmingham – 22nd February 2021
Tagging
Context-aware computing & Web-based APIs – Sandy Gould, University of Birmingham – 22nd February 2021
APIs
– We’re going to talk about the Twitter API and the Strava API.
– I’m going to show you some flows and some example code.
– The example code is not something you need to fully understand, but I think it helps to see real examples.
Context-aware computing & Web-based APIs – Sandy Gould, University of Birmingham – 22nd February 2021
Example API – Twitter
bit.ly/twitter-api-docs
Context-aware computing & Web-based APIs – Sandy Gould, University of Birmingham – 22nd February 2021
REST and JSON – the Twitter API
consumerKey consumerKeySecret
requestToken
User Agreement (Browser) PIN
Callback
PIN Validate
accessTokenKey accessTokenSecret
Context-aware computing & Web-based APIs – Sandy Gould, University of Birmingham – 22nd February 2021
Demo client
– Authentication is usually the most difficult part of interacting with most APIs.
– Once you’re in, they’re quite easy to manipulate.
– Let’s look at a Twitter client that tweets from @MUC_Teaching.
Context-aware computing & Web-based APIs – Sandy Gould, University of Birmingham – 22nd February 2021
Inconsistencies
For complex APIs that have been developed over a long period of time, names can get confusing.
{
“aspect_type”: “update”,
“event_time”: 1516126040,
“object_id”: 1360128428,
“object_type”: “activity”,
“owner_id”: 134815,
“subscription_id”: 120475,
“updates”: {
“title”: “Messy”
}
}
{
“id” : 12345678987654321,
“resource_state” : 3,
“external_id” : ”some-uid”,
“upload_id” : 98765432123456789,
“athlete” : {
“id” : 134815,
“resource_state” : 1
},
[…] }
Context-aware computing & Web-based APIs – Sandy Gould, University of Birmingham – 22nd February 2021
REST and JSON – the Twitter API
Client ID Callback URL
User Agreement (Browser)
Authorization Token
Callback
Swap auth for access tokens
Access Token* Refresh Token
*TTL 6hrs
Context-aware computing & Web-based APIs – Sandy Gould, University of Birmingham – 22nd February 2021
Kahoot! Time! Now!
goto:
kahoot.it
Context-aware computing & Web-based APIs – Sandy Gould, University of Birmingham – 22nd February 2021