52
API 101 WHAT ARE APIS, AND HOW CAN I USE THEM TO TAKE OVER THE WORLD?

API101 Workshop - APIStrat Amsterdam 2014

  • Upload
    3scale

  • View
    749

  • Download
    1

Embed Size (px)

DESCRIPTION

This workshop was designed to help people understand what APIs are in the current world, how to plan and build them, and how to avoid common pitfalls. For more information on this topic see http://apicodex.3scale.net/content/API101

Citation preview

Page 1: API101 Workshop - APIStrat Amsterdam 2014

API 101

WHAT ARE APIS, AND HOW CAN I USE THEM TO TAKE OVER THE WORLD?

Page 2: API101 Workshop - APIStrat Amsterdam 2014

http://apicodex.3scale.net Tweet thoughts to:#apistrat #api101

TALK OVERVIEW• Intros and Getting Started

• Dive into APIs

• Business and Technical Cases

• REST Deconstructed

• API and Developer Success

Page 3: API101 Workshop - APIStrat Amsterdam 2014

http://apicodex.3scale.net Tweet thoughts to:#apistrat #api101

INTROS AND GETTING STARTED

• Who are we?

• Who are you?

• Quick API definition

• API Example

• Workshop Participation

Page 4: API101 Workshop - APIStrat Amsterdam 2014

WHO IS KIRSTEN?

API NINJA (DEVELOPER EVANGELIST)PRINCESS POLYMATH

Intros and Getting Started ->

Page 5: API101 Workshop - APIStrat Amsterdam 2014

WHO IS KEITH?

DEVELOPER EVANGELISTTROUBLEMAKER

Intros and Getting Started ->

Page 6: API101 Workshop - APIStrat Amsterdam 2014

http://www.princesspolymath.com Tweet thoughts to:#apistrat #api101

WHO ARE YOU?

Developers

Designers

Marketing

Management

Intros and Getting Started ->

Page 7: API101 Workshop - APIStrat Amsterdam 2014

http://www.princesspolymath.com Tweet thoughts to:#apistrat #api101

ELEVATOR PITCHWhat is an API?

A predictable way to communicate with a computer system

Intros and Getting Started ->

Page 8: API101 Workshop - APIStrat Amsterdam 2014

http://apicodex.3scale.net Tweet thoughts to:#apistrat #api101

IT’S A WORKSHOP!

We’re here to learn

This is a safe space

There are no stupid questions

Someone else wants to ask too

Intros and Getting Started ->

Page 9: API101 Workshop - APIStrat Amsterdam 2014

http://apicodex.3scale.net Tweet thoughts to:#apistrat #api101

ASKING QUESTIONS

Wave your hands around!

Tweet with #api101 and #apistrat

... or @synedra and @caseysoftware

Intros and Getting Started ->

Page 10: API101 Workshop - APIStrat Amsterdam 2014

http://www.princesspolymath.com Tweet thoughts to:#apistrat #api101

SWITCHBOARDS AND ICED TEA

Intros and Getting Started ->

Page 11: API101 Workshop - APIStrat Amsterdam 2014

http://www.princesspolymath.com Tweet thoughts to:#apistrat #api101

QUICK API EXAMPLEIntros and Getting Started ->

Page 12: API101 Workshop - APIStrat Amsterdam 2014

TWITTER -> WORDPRESS

Intros and Getting Started ->

Page 13: API101 Workshop - APIStrat Amsterdam 2014

http://apicodex.3scale.net Tweet thoughts to:#apistrat #api101

HOW DOES THAT WORK?

Wordpress Plugin

Twitter API WordpressUses Authentication

Searches API for #api101

Formats response

Fills in sidebar

Intros and Getting Started ->

Page 14: API101 Workshop - APIStrat Amsterdam 2014

http://apicodex.3scale.net Tweet thoughts to:#apistrat #api101

DIVE INTO APIS

• Quick history of APIs

• What do current APIs make possible?

Page 15: API101 Workshop - APIStrat Amsterdam 2014

http://apicodex.3scale.net Tweet thoughts to:#apistrat #api101

VERY BRIEF HISTORY

• Computer -> Computer• Databases• Backups

• Client -> Server• Email• Content Management Systems

• Web Client -> API Server

Dive into APIs ->

Page 16: API101 Workshop - APIStrat Amsterdam 2014

http://apicodex.3scale.net Tweet thoughts to:#apistrat #api101

WHAT CAN APIS DO?

Dive into APIs ->

Page 17: API101 Workshop - APIStrat Amsterdam 2014

http://apicodex.3scale.net Tweet thoughts to:#apistrat #api101

QUICK BREAK!

• Don’t forget to tweet or comment your questions or comments!

• Audience questions?

• Aaaaannnnndddd.... over to Keith!

Page 18: API101 Workshop - APIStrat Amsterdam 2014

http://www.princesspolymath.com Tweet thoughts to:#apistrat #api101

So you want an API?

D Keith Casey Jr Platform GuyAustin, TX Op3nvoice

Page 19: API101 Workshop - APIStrat Amsterdam 2014

http://apicodex.3scale.net Tweet thoughts to:#apistrat #api101

Talk Overview

• Intros & Getting Started

• Dive into APIs

• Business/Technical Cases

• REST Deconstructed

• API & Developer Success

Page 20: API101 Workshop - APIStrat Amsterdam 2014

Business Cases

Page 21: API101 Workshop - APIStrat Amsterdam 2014

Mobile/Market Penetration

Page 22: API101 Workshop - APIStrat Amsterdam 2014

Drive Usage

Page 23: API101 Workshop - APIStrat Amsterdam 2014

Defensive Strategy

Page 24: API101 Workshop - APIStrat Amsterdam 2014

Partner Connectivity

Page 25: API101 Workshop - APIStrat Amsterdam 2014

Technical Cases

Page 26: API101 Workshop - APIStrat Amsterdam 2014

Abstraction of Complexity

Page 27: API101 Workshop - APIStrat Amsterdam 2014

Simplifying Interfaces

Page 28: API101 Workshop - APIStrat Amsterdam 2014

Metered Usage

Page 29: API101 Workshop - APIStrat Amsterdam 2014

All of the Above

Page 30: API101 Workshop - APIStrat Amsterdam 2014

http://apicodex.3scale.net Tweet thoughts to:#apistrat #api101

Platform as a Strategy

Making Stuff: How can we build more stuff?

Examples: manufacturing, NYT/blogging networks

Optimizing Stuff: How can we better distribute the stuff?

Examples: Walmart, search engines/RSS readers

Redefine Stuff: How can we redefine ‘stuff’ & find new ways to solve the problem?

Examples: Ebay/Amazon Prime, Twitter

Source: http://platformed.info/platform-thinking/

Page 31: API101 Workshop - APIStrat Amsterdam 2014

Architectural Considerations

Page 32: API101 Workshop - APIStrat Amsterdam 2014

http://apicodex.3scale.net Tweet thoughts to:#apistrat #api101

What you can do: Affordances

“An affordance is a quality of an object, or an environment, which allows a user to perform an action.”

Source: http://en.wikipedia.org/wiki/Affordance

WRT Hypermedia: http://amundsen.com/blog/archives/1109

Page 33: API101 Workshop - APIStrat Amsterdam 2014

http://apicodex.3scale.net Tweet thoughts to:#apistrat #api101

How you can do it: Hypermedia

Page 34: API101 Workshop - APIStrat Amsterdam 2014

http://apicodex.3scale.net Tweet thoughts to:#apistrat #api101

What it looks like: Schema

“An outline or model; organized pattern of thought or behavior”

Source: http://en.wikipedia.org/wiki/Schema_(psychology)

WRT Hypermedia: http://json-schema.org

Page 35: API101 Workshop - APIStrat Amsterdam 2014

http://apicodex.3scale.net Tweet thoughts to:#apistrat #api101

Who can do it: Authentication & Authorization

Authentication - Confirming who are you

Authorization - Granting access to perform certain actions

http://en.wikipedia.org/wiki/Authentication

http://en.wikipedia.org/wiki/Authorization

Page 36: API101 Workshop - APIStrat Amsterdam 2014

http://apicodex.3scale.net Tweet thoughts to:#apistrat #api101

Talk Overview

• Intros & Getting Started

• Dive into APIs

• Business/Technical Cases

• REST Deconstructed

• API & Developer Success

Page 37: API101 Workshop - APIStrat Amsterdam 2014

http://apicodex.3scale.net Tweet thoughts to:#apistrat #api101

TheAPIDesignBook.com

Page 38: API101 Workshop - APIStrat Amsterdam 2014

http://apicodex.3scale.net Tweet thoughts to:#apistrat #api101

TALK OVERVIEW• Intros and Getting Started

• Dive into APIs

• Business Cases

• REST Deconstructed

• API and Developer Success

Page 39: API101 Workshop - APIStrat Amsterdam 2014

http://apicodex.3scale.net Tweet thoughts to:#apistrat #api101

REST DECONSTRUCTED

• HTTP• Structure• Verbs

• REST• Structure• Verbs

• Response Formats• JSON• XML

Page 40: API101 Workshop - APIStrat Amsterdam 2014

http://apicodex.3scale.net Tweet thoughts to:#apistrat #api101

CONVERSATIONS• Unique names for things

Iced Tea

• Create, Read, Update and Delete (CRUD) Order, Get order back, Change order, Cancel order

• Substitutions and changesUnsweetened, Extra Ice

• Context - For here or to go?

REST Deconstructed ->

Page 41: API101 Workshop - APIStrat Amsterdam 2014

http://apicodex.3scale.net Tweet thoughts to:#apistrat #api101

HTTP

• HyperText Transfer Protocol

• Main internet protocol

• Browser->web server

• Technically - chatty, inefficient... simple

REST Deconstructed ->

Page 42: API101 Workshop - APIStrat Amsterdam 2014

http://apicodex.3scale.net Tweet thoughts to:#apistrat #api101

HTTP MESSAGES

• Simple resource address - URL (name)

• Request -> Response

• Context in headers

• Substitutions: added to name

REST Deconstructed -> HTTP

Page 43: API101 Workshop - APIStrat Amsterdam 2014

http://apicodex.3scale.net Tweet thoughts to:#apistrat #api101

REST STRUCTURE

• URL -> Name

• Context in headers

• Substitutions and changes

REST Deconstructed -> HTTP

Page 44: API101 Workshop - APIStrat Amsterdam 2014

http://apicodex.3scale.net Tweet thoughts to:#apistrat #api101

HTTP VERBS

• GET

• POST

• PUT

• DELETE

• ... and a few others

REST Deconstructed -> HTTP

Page 45: API101 Workshop - APIStrat Amsterdam 2014

http://apicodex.3scale.net Tweet thoughts to:#apistrat #api101

REST ACTIONS

• GET - Read back order

• POST - Place order

• PUT - Change order

• DELETE - Cancel order

• ... and a few others

REST Deconstructed -> HTTP

Page 46: API101 Workshop - APIStrat Amsterdam 2014

http://apicodex.3scale.net Tweet thoughts to:#apistrat #api101

RESPONSE FORMATSJSON { “My thing” : “Awesome sauce” }

• Smaller / More efficient• More human readable• Simpler to use in many programming languages• More natural for web developers

XML <stuff> <my_thing>Awesome sauce</my_thing> </stuff>

• More verbose• Less human readable• Good integration with .NET• Supports better meta- information with attributes

REST Deconstructed -> Formats

Page 47: API101 Workshop - APIStrat Amsterdam 2014

http://apicodex.3scale.net Tweet thoughts to:#apistrat #api101

TALK OVERVIEW• Intros and Getting Started

• Dive into APIs

• Business Cases

• REST Deconstructed

• API and Developer Success

Page 48: API101 Workshop - APIStrat Amsterdam 2014

http://apicodex.3scale.net Tweet thoughts to:#apistrat #api101

API AND DEVELOPER SUCCESS

• API Design

• Marketing your API

• Supporting your Developers

Page 49: API101 Workshop - APIStrat Amsterdam 2014

http://apicodex.3scale.net Tweet thoughts to:#apistrat #api101

API and Developer Success ->

API DESIGN• User Experience - What do you want people to do with your

API?

• System constraints - How do you want them to do it?

• API Design and DevelopmentThursday, 11:20

• Hypermedia APIsThursday, 1:50

Page 50: API101 Workshop - APIStrat Amsterdam 2014

http://apicodex.3scale.net Tweet thoughts to:#apistrat #api101

MARKETING YOUR API

• Clearly communicate API goals and usage

• Lower barrier to entry for developers

• API Marketing & Developer CommunitiesFriday, 11:45

API and Developer Success ->

Page 51: API101 Workshop - APIStrat Amsterdam 2014

http://apicodex.3scale.net Tweet thoughts to:#apistrat #api101

DEVELOPER SUPPORT• Clear, consistent communication

• Fantastic documentation, tutorials, libraries

• Forums, participation

• Provide excellent exploration and development tools

• In short, respect your developers’ time and reduce confusion

API and Developer Success ->

Page 52: API101 Workshop - APIStrat Amsterdam 2014

http://apicodex.3scale.net Tweet thoughts to:#apistrat #api101

QUESTIONS?

• Final check for questions on twitter/comments

• Audience questions?

• http://apicodex.3scale.net/content/API101