<<

Intro to Web : Flickr//

Molly Des Jardin Japanese Studies Librarian What is an API?

• “Application Programming Interface” • A way to interact with other applications • Standardized “interface” • You don’t need to know how it works behind the scenes, just how to make it work for your application • UI (user interface) for computers, like a GUI for humans Examples of APIs

• Web Services • Programming Languages – Flickr • (used by Android) – Tumblr – – Facebook • Operating Systems – Photobucket • Windows – Google • OS X and iOS (Cocoa) – Yahoo! Web APIs/Web Services

• A way to access the databases running various • Build a complex URL and type it into your browser, or run from a program/script • Returns data from the database usually in XML or JSON format • May require an API key or OAuth key • Examples today: Flickr, Tumblr, Facebook OAuth • What is OAuth? – A way to log you in and authenticate your account without your giving away your actual password – Ex: How you register for other websites using your Facebook or Google login API Keys

• What is an API key? – API keys are used to track and control how the API is being used – Identifies who is calling the API, unique identifier AND secret token – Has a set of access rights • Can let you log in to post to your account, etc. • Not all APIs require keys Flickr Web API

• Requires API key (freely apply on ) • Some functions require Flickr authentication (user login) • Extensive documentation • App Garden • You can try it out online!

https://www.flickr.com/services/api/

Components:

https://api.flickr.com/services/rest/?method=

• flickr.groups.members.getList (the method) • & (goes between arguments) • api_key= (your API key) • group_id= (the group’s ID number) • format=json (format of data returned is JSON)

Tumblr Web API • Needs OAuth key to get API key • Returns data in JSON format • Start your URL with http://api.tumblr.com/v2/ • Then attach your methods and arguments Getting Photo Posts

Tumblr API Console

Test out your calls and see live examples of using official clients with the API console:

http://api.tumblr.com/console Register With Tumblr Facebook Graph API

• What can you do? Just about everything. • Plugins and app connections: – Use like button on other websites – Post Facebook comments on news sites and – Share to your Facebook feed from another website – Access a page’s events – Use your Facebook photos and info on other apps • This is how Tinder works – Update your Facebook feed from other apps • This is how and Twitter can post to your feed https://developers.facebook.com/tools/explorer/ Using Clients

• You can also use many APIs via various programming languages • Use it directly in the language instead of calling a URL; simpler and more readable • Ex: Python, Java, Ruby, PHP • Can make it easier to write an application • Often not developed by the website Tumblr’s Python Client Tumblr’s Python Client Try It Out!

• Create a username for Tumblr and/or Flickr • Get an OAuth key for Tumblr or a Facebook user access token • Get API keys for Tumblr and/or Flickr • Try some sample commands in the Tumblr console, Facebook Graph Explorer, or Flickr • Flickr doesn’t require any keys or tokens • Build a URL and see what you get back Try It Out! https://www.flickr.com/services/api/ https://developers.facebook.com/ tools/explorer/

https://api.tumblr.com/console