SlideShare ist ein Scribd-Unternehmen logo
1 von 45
SouthEast LinuxFest 2015
Your API is Bad and You Should Feel Bad
Amanda Folson
AmbassadorAwsum
SouthEast LinuxFest
Who am I to judge?
• Associate Product Manager/Developer
Evangelist at PagerDuty
• Average consumer of APIs and IPAs
• Well RESTed (you can boo at my pun)
• Professional conference attendee and
tinkerer
6/17/2015Your API is Bad and You Should Feel Bad
SouthEast LinuxFest
APIs are Everywhere
6/17/2015
SouthEast LinuxFest
Great, but why do I care?
• Provides a uniform interface for interacting
with your application
• API allows you to shard off services
– Decouples services
– Website->API
– Mobile->API
• This is cool if you’re into SoA
– I am.
6/17/2015
SouthEast LinuxFest
Types of Application
Programming Interfaces
• Language/Platform/Library APIs
– Win32
– C++
– OpenGL
• Web APIs
– SOAP
– XML-RPC
– REST
6/17/2015
SouthEast LinuxFest
SOAP
• Stateful
• WS-Security
• Mostly obvious procedures (getRecord,
delRecord)
– Need to know procedure name
– Need to know order of parameters
6/17/2015
SouthEast LinuxFest
REST
• Gaining adoption
• HTTP-based (usually)
• No need to know order of parameters in
most cases
• Can return XML, JSON, ?
6/17/2015
SouthEast LinuxFest
Sounds Good, Let’s Build
6/17/2015
SouthEast LinuxFest
“The best design is the simplest
one that works.”
6/17/2015
Albert Einstein
Your API is Bad
SouthEast LinuxFest
Slow Down
• Don’t rush into v1,
v2, etc.
• Make sure you meet
goals
• Involve
users/engineers
from the start
• This is hard
6/17/2015
SouthEast LinuxFest
IncrediBL Overview
• DNSBL (lists IPs to blacklist)
• Requires DNS servers
– Lookups
– Domain resolution
• Requires database servers
• Requires web servers
• Requires patience
6/17/2015
SouthEast LinuxFest
Design
• Immutable blueprint
• Contract between you
and users
• SHARE
– The worst feedback is the
feedback you don’t hear
• Account for existing
architecture
• Changes should provide
actual value not
perceived/potential value
• Design for uniformity
6/17/2015
SouthEast LinuxFest
Know Thy Audience
• Who is this for?
– Us? Internal?
– Them? Business partners/3rd parties?
– ???
• What’s the incentive?
6/17/2015
SouthEast LinuxFest
Ask!
• Stakeholders will tell you what they need
• Regardless of version, feedback should
make it into your spec
• Build something people want
6/17/2015
SouthEast LinuxFest
Spec Tools
• Apiary/API Blueprint
• Swagger
• RAML
The list goes on…
6/17/2015
SouthEast LinuxFest
What is REST?
• Representational
State Transfer
• HTTP-based routing
and methods
– PUT/GET/POST/etc.
• Stateless
– No sessions
– HATEOAS
6/17/2015
SouthEast LinuxFest
Resources
• /resource is a gateway to an area of your
application
– /users
– /places
– /things
• CRUD actions can be performed on a single
resource
– GET vs getUser, getMessage, getThing
• Use plural nouns, no verbs (GET, CREATE, etc.)
– Can be for a single item or a collection of items
6/17/2015
SouthEast LinuxFest
Action Verbs
6/17/2015
SouthEast LinuxFest
GET
• GET data from a /resource
• You do this daily by browsing the web. Go
you.
• Uses query string to tell API what data to
retrieve
• Returns 200 if everything’s OK
6/17/2015
SouthEast LinuxFest
POST
• Used to create/manipulate data
• Relies on a message body being sent vs
query string (XML, JSON, ?)
• Returns 201 Created
• Should return URI to newly created
resource
6/17/2015
SouthEast LinuxFest
PUT
• Update a resource
• OVERWRITES EXISTING OBJECT WITH NEW
ONE
– You don’t have to allow this, be careful with this
because its use is inconsistent across APIs, should
be used consistently across resources
– Return 201 created if you do this
– Can’t use PUT within the resource itself (/messages)
without an ID
– PUT should never be use to wrangle partial updates
6/17/2015
SouthEast LinuxFest
PATCH
• Updates only the properties provided in the
call
• 200 on successful update
• 304 if nothing changed
6/17/2015
SouthEast LinuxFest
DELETE
• Don’t allow on an entire collection (/users
or /messages or /places) or limit it
• 200 if item or collection was deleted
• 204 if item or collection was deleted but
there’s no body to return
• 202 if request was accepted and deletion
was queued (CDN, cache, etc.)
6/17/2015
SouthEast LinuxFest
OPTIONS
• Not for interacting with data
• Informs clients of available methods
• Return 200 or 204
• You could also return 405 (Method Not
Allowed) but why would you do that you
monster?
• Useful when method should work on items but
not collections within a resource (don’t DELETE
and collection of users or messages)
6/17/2015
SouthEast LinuxFest
Content Types
• Be nice, return more than one
– JSON and XML are common
– Different clients have different needs
– Easy to add new types as needed if you design for this
early on
• If you only allow one type, inform that others
aren’t allowed
• Use Content-type: to receive and parse client data
• Can use Accept header to see what format client
wants back
• For simplicity you can just send back what they
send
6/17/2015
SouthEast LinuxFest
Replying
• Provide information on failures beyond
HTTP status codes.
– “API Key does not have access to modify
resource” is better than 403 Forbidden alone
– 200 OK, 201 Created, 204 No Content, 304 Not
Modified, 5xx We Screwed Up, Not You
– HTTP status codes let client decide what to do
next
– No true standardized error message format, but
Google Errors and JSON API are trying
6/17/2015
SouthEast LinuxFest
HATEOAS
• Hypermedia As The Engine Of Application State
• Hypertext links to other resources (like links on a page)
– Every object has actions to perform
• Choose your own adventure for navigation/pagination
– Give clients list of actions to take
– Client tracks state
– Server provides options to change state
• HARD
– Requires knowing possible ways to interact with object
• Clients have to know how to handle this, some will
hardcode anyway
6/17/2015
SouthEast LinuxFest
Hypermedia Specs
• Wishful thinking
• There are no standards for this
• JSON API? Custom? HAL?
• HAL/JSON API are good starting points with
wide adoption
6/17/2015
SouthEast LinuxFest
Versioning
• API is not the time to cowboy
deploys/releases
• Design so that you never have to version
• Migrations are hard
• Maintaining n versions
• Deprecate carefully
– Not everyone can update in a weekend
6/17/2015
SouthEast LinuxFest
When to Version
• Backwards incompatible changes
– Creating new data models
• When your API no longer meets you or
your users’ needs
BUT NOT
• When you add new resources or data fields
6/17/2015
SouthEast LinuxFest
Version in URI
• https://api.myawesomestuff.com/v1/stuff
• Version is obvious to users
• Relative paths can’t always be hypermedia
driven
6/17/2015
SouthEast LinuxFest
Version in Content-type
• Content-type: application/json+v1
• Cleaner, not as obvious
• Can default to a version if none is specified
• Devs need to know that they need to send
this
6/17/2015
SouthEast LinuxFest
Version in Custom Header
• Version: 1
• MyApp: 2.6
• No standards
• Requires GREAT docs
• Confusing for users who aren’t expecting it
6/17/2015
SouthEast LinuxFest
Caching
• Ssscccaaallleee
• Cache on API client end
• Cache-control header (public, expires-at,
no-cache, max-age), Expires
• Important that this info end up in
docs/SDKs
6/17/2015
SouthEast LinuxFest
Authentication
• Kill Basic Auth
– Keep username/passwords safe
• OAuth
– Require users to explicitly authorize an app
– Tricky for some people to implement
– Restrict auth to HTTPS endpoints
– Restrict domains allowed to auth
– MITM attacks, make sure users store tokens
well
6/17/2015
SouthEast LinuxFest
Security
• Treat users as hostile
• Don’t rely on single method
• Apply layers of security
– Permissions-based API keys/UAC
• Per app, not per account. Will depend on your
architecture
– DNSBL
– Content length/depth limits
• ¿Recursive?
– SQL injection
– Rate limit/throttling
6/17/2015
SouthEast LinuxFest
Prototyping
• Laravel/Lumen, Flask, Rails, Mojolicious
– RESTful HTTP routing
– Zero to API in ~1hr
• Specs
– Apiary, Mockable, RAML
– Frameworks allow importing of specs
– Some spec tools can autogenerate SDKs for you
(APIMatic)
• Chrome REST API client, Postman, jsfiddle
6/17/2015
SouthEast LinuxFest
Now what?
6/17/2015
SouthEast LinuxFest
Maintenance
• Plan to maintain API, SDKs, docs
• Don’t launch and leave
• Allocate maintenance resources
• Community? Paid service?
6/17/2015
SouthEast LinuxFest
Things Bad People Do
• Log in to view API docs
– Counter to open source mentality to use docs as
a lead generation tool
• Use HTTP (needs more S)
• No documentation
• Require name/password in URL structure
– Can be saved in browser/CLI which is very
insecure
6/17/2015
SouthEast LinuxFest
SDKs
• Nice when these are provided to users
• Should have maintenance plan like API
• Need to be kept in sync
• Should be made by language experts
6/17/2015
SouthEast LinuxFest
Documentation
• API is useless if no one knows how to use it
• NEEDS to be part of design process
• All inclusive
– Errors/methods/parameters
– Reference and tutorial
– In sync with changes to API
• Include how to get help
• Open source is nice 
6/17/2015
SouthEast LinuxFest
The best API is the one that exists.
6/17/2015Your API is Bad and You Should Feel Bad
SouthEast LinuxFest
/resources
• Build APIs You Won’t Hate - Phil Sturgeon
http://apisyouwonthate.com/
• Undisturbed REST - Mike Stowe
http://mulesoft.com/restbook
• Apiary – http://apiary.io
• RESTful Web APIs - Leonard Richardson, Mike
Amundsen, Sam Ruby
6/17/2015
Thank you.
pagerduty.com
SouthEast LinuxFest
amanda@pagerduty.com
http://amandafolson.net
AmbassadorAwsum

Weitere ähnliche Inhalte

Was ist angesagt?

Sakai Hierarchy Framework Changes Overview (not implemented)
Sakai Hierarchy  Framework Changes Overview (not implemented)Sakai Hierarchy  Framework Changes Overview (not implemented)
Sakai Hierarchy Framework Changes Overview (not implemented)Charles Severance
 
Drupal Site Audit - SFDUG
Drupal Site Audit - SFDUGDrupal Site Audit - SFDUG
Drupal Site Audit - SFDUGJon Peck
 
APIs : Mapping the way
APIs : Mapping the wayAPIs : Mapping the way
APIs : Mapping the wayWSO2
 
Olympya web-tools 2011
Olympya web-tools 2011Olympya web-tools 2011
Olympya web-tools 2011Paulo Mattos
 
Alfresco Day Milano 2016 - Demo Data
Alfresco Day Milano 2016 - Demo DataAlfresco Day Milano 2016 - Demo Data
Alfresco Day Milano 2016 - Demo DataAlfresco Software
 
Tarabica 2019 - Migration from ASP.NET MVC to ASP.NET Core
Tarabica 2019 - Migration from ASP.NET MVC to ASP.NET CoreTarabica 2019 - Migration from ASP.NET MVC to ASP.NET Core
Tarabica 2019 - Migration from ASP.NET MVC to ASP.NET CoreMiroslav Popovic
 
Documenting an API for the First Time? Quick-Start Tips for Your First API Do...
Documenting an API for the First Time? Quick-Start Tips for Your First API Do...Documenting an API for the First Time? Quick-Start Tips for Your First API Do...
Documenting an API for the First Time? Quick-Start Tips for Your First API Do...Petko Mikhailov
 
RFE/RL: Implementation of Quickbase custom made application
RFE/RL: Implementation of Quickbase custom made applicationRFE/RL: Implementation of Quickbase custom made application
RFE/RL: Implementation of Quickbase custom made applicationJaroslav Lhotak
 
Effective Microservices In a Data-centric World
Effective Microservices In a Data-centric WorldEffective Microservices In a Data-centric World
Effective Microservices In a Data-centric WorldRandy Shoup
 
Data Pipelines: Big Data Meets Salesforce
Data Pipelines: Big Data Meets SalesforceData Pipelines: Big Data Meets Salesforce
Data Pipelines: Big Data Meets SalesforceSalesforce Developers
 
Velocity - Edge UG
Velocity - Edge UGVelocity - Edge UG
Velocity - Edge UGPhil Pursglove
 
Create Salesforce online IDE in 30 minutes
Create Salesforce online IDE in 30 minutesCreate Salesforce online IDE in 30 minutes
Create Salesforce online IDE in 30 minutesJitendra Zaa
 
Resume
ResumeResume
ResumeMina k
 
How to Contribute to Apache Flink (and Flink at the Apache Software Foundation)
How to Contribute to Apache Flink (and Flink at the Apache Software Foundation)How to Contribute to Apache Flink (and Flink at the Apache Software Foundation)
How to Contribute to Apache Flink (and Flink at the Apache Software Foundation)Robert Metzger
 
How Master GraphQL by Francois de Campredon
How Master GraphQL by Francois de CampredonHow Master GraphQL by Francois de Campredon
How Master GraphQL by Francois de CampredonTheFamily
 
introduction v4
introduction v4introduction v4
introduction v4transformtoit
 

Was ist angesagt? (20)

Sakai Hierarchy Framework Changes Overview (not implemented)
Sakai Hierarchy  Framework Changes Overview (not implemented)Sakai Hierarchy  Framework Changes Overview (not implemented)
Sakai Hierarchy Framework Changes Overview (not implemented)
 
Drupal Site Audit - SFDUG
Drupal Site Audit - SFDUGDrupal Site Audit - SFDUG
Drupal Site Audit - SFDUG
 
The Apache Way
The Apache WayThe Apache Way
The Apache Way
 
APIs : Mapping the way
APIs : Mapping the wayAPIs : Mapping the way
APIs : Mapping the way
 
Eloquent workflow: delivering data from database to client in a right way
Eloquent workflow: delivering data from database to client in a right wayEloquent workflow: delivering data from database to client in a right way
Eloquent workflow: delivering data from database to client in a right way
 
Olympya web-tools 2011
Olympya web-tools 2011Olympya web-tools 2011
Olympya web-tools 2011
 
Olist Architecture v2.0
Olist Architecture v2.0Olist Architecture v2.0
Olist Architecture v2.0
 
Alfresco Day Milano 2016 - Demo Data
Alfresco Day Milano 2016 - Demo DataAlfresco Day Milano 2016 - Demo Data
Alfresco Day Milano 2016 - Demo Data
 
Tarabica 2019 - Migration from ASP.NET MVC to ASP.NET Core
Tarabica 2019 - Migration from ASP.NET MVC to ASP.NET CoreTarabica 2019 - Migration from ASP.NET MVC to ASP.NET Core
Tarabica 2019 - Migration from ASP.NET MVC to ASP.NET Core
 
Documenting an API for the First Time? Quick-Start Tips for Your First API Do...
Documenting an API for the First Time? Quick-Start Tips for Your First API Do...Documenting an API for the First Time? Quick-Start Tips for Your First API Do...
Documenting an API for the First Time? Quick-Start Tips for Your First API Do...
 
RFE/RL: Implementation of Quickbase custom made application
RFE/RL: Implementation of Quickbase custom made applicationRFE/RL: Implementation of Quickbase custom made application
RFE/RL: Implementation of Quickbase custom made application
 
Effective Microservices In a Data-centric World
Effective Microservices In a Data-centric WorldEffective Microservices In a Data-centric World
Effective Microservices In a Data-centric World
 
Data Pipelines: Big Data Meets Salesforce
Data Pipelines: Big Data Meets SalesforceData Pipelines: Big Data Meets Salesforce
Data Pipelines: Big Data Meets Salesforce
 
Velocity - Edge UG
Velocity - Edge UGVelocity - Edge UG
Velocity - Edge UG
 
Epita pres
Epita presEpita pres
Epita pres
 
Create Salesforce online IDE in 30 minutes
Create Salesforce online IDE in 30 minutesCreate Salesforce online IDE in 30 minutes
Create Salesforce online IDE in 30 minutes
 
Resume
ResumeResume
Resume
 
How to Contribute to Apache Flink (and Flink at the Apache Software Foundation)
How to Contribute to Apache Flink (and Flink at the Apache Software Foundation)How to Contribute to Apache Flink (and Flink at the Apache Software Foundation)
How to Contribute to Apache Flink (and Flink at the Apache Software Foundation)
 
How Master GraphQL by Francois de Campredon
How Master GraphQL by Francois de CampredonHow Master GraphQL by Francois de Campredon
How Master GraphQL by Francois de Campredon
 
introduction v4
introduction v4introduction v4
introduction v4
 

Andere mochten auch

Example work sample RNChatterjee April 2015
Example work sample RNChatterjee April 2015Example work sample RNChatterjee April 2015
Example work sample RNChatterjee April 2015Rob Chatterjee
 
kalisindh thermal report by Hariom -------begining
kalisindh thermal report by Hariom -------beginingkalisindh thermal report by Hariom -------begining
kalisindh thermal report by Hariom -------begininghariom nagar
 
Gyakorlati social media ĂştmutatĂł - Socialize 2012.11.27
Gyakorlati social media ĂştmutatĂł - Socialize 2012.11.27Gyakorlati social media ĂştmutatĂł - Socialize 2012.11.27
Gyakorlati social media ĂştmutatĂł - Socialize 2012.11.27Socialize
 
Trabajclase28
Trabajclase28Trabajclase28
Trabajclase28rosy
 
Seminario: "Percorsi vita indipendente"
Seminario: "Percorsi vita indipendente" Seminario: "Percorsi vita indipendente"
Seminario: "Percorsi vita indipendente" Lelio Bizzarri
 
Patriots Down Jets; Move to 6-0
Patriots Down Jets; Move to 6-0Patriots Down Jets; Move to 6-0
Patriots Down Jets; Move to 6-0Brad Jermeland
 
If you don´t understand, how can you learn?
If you don´t understand, how can you learn? If you don´t understand, how can you learn?
If you don´t understand, how can you learn? João Soares
 
02 presentacion renta_segunda_parte_2010_udla(1)
02 presentacion renta_segunda_parte_2010_udla(1)02 presentacion renta_segunda_parte_2010_udla(1)
02 presentacion renta_segunda_parte_2010_udla(1)pochologonzalez
 
Janet Gunter - Reflections of a participant observer
Janet Gunter - Reflections of a participant observer Janet Gunter - Reflections of a participant observer
Janet Gunter - Reflections of a participant observer Maker Assembly
 
MĂŠtodo montessori
MĂŠtodo montessoriMĂŠtodo montessori
MĂŠtodo montessoriteamofernanda
 
Middleware as Code with mruby
Middleware as Code with mrubyMiddleware as Code with mruby
Middleware as Code with mrubyHiroshi SHIBATA
 
Learn REST in 18 Slides
Learn REST in 18 SlidesLearn REST in 18 Slides
Learn REST in 18 SlidesSuraj Gupta
 
Establishing a Scalable, Resilient Web Architecture | AWS Public Sector Summi...
Establishing a Scalable, Resilient Web Architecture | AWS Public Sector Summi...Establishing a Scalable, Resilient Web Architecture | AWS Public Sector Summi...
Establishing a Scalable, Resilient Web Architecture | AWS Public Sector Summi...Amazon Web Services
 
2015 rubyconf - 百大媒體網站從 Wordpress 到 Rails 的大小事
2015 rubyconf - 百大媒體網站從 Wordpress 到 Rails 的大小事2015 rubyconf - 百大媒體網站從 Wordpress 到 Rails 的大小事
2015 rubyconf - 百大媒體網站從 Wordpress 到 Rails 的大小事Ronald Hsu
 
SearchLove Boston 2016 | Mackenzie Fogelson | Why Content Strategy isn't Enough
SearchLove Boston 2016 | Mackenzie Fogelson | Why Content Strategy isn't EnoughSearchLove Boston 2016 | Mackenzie Fogelson | Why Content Strategy isn't Enough
SearchLove Boston 2016 | Mackenzie Fogelson | Why Content Strategy isn't EnoughDistilled
 
Eiropas Savienības fondu mijiedarbība lauku uzņēmēju atbalstam 2014-2020
Eiropas Savienības fondu mijiedarbība lauku uzņēmēju atbalstam 2014-2020Eiropas Savienības fondu mijiedarbība lauku uzņēmēju atbalstam 2014-2020
Eiropas Savienības fondu mijiedarbība lauku uzņēmēju atbalstam 2014-2020Ekonomikas ministrija
 

Andere mochten auch (20)

AlfĂĄk internetezĂŠsi szokĂĄsai
AlfĂĄk internetezĂŠsi szokĂĄsaiAlfĂĄk internetezĂŠsi szokĂĄsai
AlfĂĄk internetezĂŠsi szokĂĄsai
 
Example work sample RNChatterjee April 2015
Example work sample RNChatterjee April 2015Example work sample RNChatterjee April 2015
Example work sample RNChatterjee April 2015
 
Trabajo 05 01 13
Trabajo  05 01 13Trabajo  05 01 13
Trabajo 05 01 13
 
kalisindh thermal report by Hariom -------begining
kalisindh thermal report by Hariom -------beginingkalisindh thermal report by Hariom -------begining
kalisindh thermal report by Hariom -------begining
 
Gyakorlati social media ĂştmutatĂł - Socialize 2012.11.27
Gyakorlati social media ĂştmutatĂł - Socialize 2012.11.27Gyakorlati social media ĂştmutatĂł - Socialize 2012.11.27
Gyakorlati social media ĂştmutatĂł - Socialize 2012.11.27
 
Trabajclase28
Trabajclase28Trabajclase28
Trabajclase28
 
Seminario: "Percorsi vita indipendente"
Seminario: "Percorsi vita indipendente" Seminario: "Percorsi vita indipendente"
Seminario: "Percorsi vita indipendente"
 
Patriots Down Jets; Move to 6-0
Patriots Down Jets; Move to 6-0Patriots Down Jets; Move to 6-0
Patriots Down Jets; Move to 6-0
 
If you don´t understand, how can you learn?
If you don´t understand, how can you learn? If you don´t understand, how can you learn?
If you don´t understand, how can you learn?
 
Escuela Cantonal de AgroecologĂ­a
Escuela Cantonal de AgroecologĂ­aEscuela Cantonal de AgroecologĂ­a
Escuela Cantonal de AgroecologĂ­a
 
02 presentacion renta_segunda_parte_2010_udla(1)
02 presentacion renta_segunda_parte_2010_udla(1)02 presentacion renta_segunda_parte_2010_udla(1)
02 presentacion renta_segunda_parte_2010_udla(1)
 
Free-lance PR Practitioner
Free-lance PR PractitionerFree-lance PR Practitioner
Free-lance PR Practitioner
 
Janet Gunter - Reflections of a participant observer
Janet Gunter - Reflections of a participant observer Janet Gunter - Reflections of a participant observer
Janet Gunter - Reflections of a participant observer
 
MĂŠtodo montessori
MĂŠtodo montessoriMĂŠtodo montessori
MĂŠtodo montessori
 
Middleware as Code with mruby
Middleware as Code with mrubyMiddleware as Code with mruby
Middleware as Code with mruby
 
Learn REST in 18 Slides
Learn REST in 18 SlidesLearn REST in 18 Slides
Learn REST in 18 Slides
 
Establishing a Scalable, Resilient Web Architecture | AWS Public Sector Summi...
Establishing a Scalable, Resilient Web Architecture | AWS Public Sector Summi...Establishing a Scalable, Resilient Web Architecture | AWS Public Sector Summi...
Establishing a Scalable, Resilient Web Architecture | AWS Public Sector Summi...
 
2015 rubyconf - 百大媒體網站從 Wordpress 到 Rails 的大小事
2015 rubyconf - 百大媒體網站從 Wordpress 到 Rails 的大小事2015 rubyconf - 百大媒體網站從 Wordpress 到 Rails 的大小事
2015 rubyconf - 百大媒體網站從 Wordpress 到 Rails 的大小事
 
SearchLove Boston 2016 | Mackenzie Fogelson | Why Content Strategy isn't Enough
SearchLove Boston 2016 | Mackenzie Fogelson | Why Content Strategy isn't EnoughSearchLove Boston 2016 | Mackenzie Fogelson | Why Content Strategy isn't Enough
SearchLove Boston 2016 | Mackenzie Fogelson | Why Content Strategy isn't Enough
 
Eiropas Savienības fondu mijiedarbība lauku uzņēmēju atbalstam 2014-2020
Eiropas Savienības fondu mijiedarbība lauku uzņēmēju atbalstam 2014-2020Eiropas Savienības fondu mijiedarbība lauku uzņēmēju atbalstam 2014-2020
Eiropas Savienības fondu mijiedarbība lauku uzņēmēju atbalstam 2014-2020
 

Ähnlich wie Your API is Bad and You Should Feel Bad

Pragmatic REST APIs
Pragmatic REST APIsPragmatic REST APIs
Pragmatic REST APIsamesar0
 
Intro to Web Services - 2015 STC Summit talk
Intro to Web Services - 2015 STC Summit talkIntro to Web Services - 2015 STC Summit talk
Intro to Web Services - 2015 STC Summit talkEd Marshall
 
Web Planning an Effective Integration with a 3rd party API to Scale
Web Planning an Effective Integration with a 3rd party API to ScaleWeb Planning an Effective Integration with a 3rd party API to Scale
Web Planning an Effective Integration with a 3rd party API to Scalebrettwise
 
Lessons learned on the Azure API Stewardship Journey.pptx
Lessons learned on the Azure API Stewardship Journey.pptxLessons learned on the Azure API Stewardship Journey.pptx
Lessons learned on the Azure API Stewardship Journey.pptxapidays
 
REST API Recommendations
REST API RecommendationsREST API Recommendations
REST API RecommendationsJeelani Shaik
 
Api crash
Api crashApi crash
Api crashJames Wong
 
Api crash
Api crashApi crash
Api crashFraboni Ec
 
Building rich interface components with SharePoint
Building rich interface components with SharePointBuilding rich interface components with SharePoint
Building rich interface components with SharePointLouis-Philippe Lavoie
 
apidays LIVE Paris 2021 - Lessons from the API Stewardship Journey in Azure b...
apidays LIVE Paris 2021 - Lessons from the API Stewardship Journey in Azure b...apidays LIVE Paris 2021 - Lessons from the API Stewardship Journey in Azure b...
apidays LIVE Paris 2021 - Lessons from the API Stewardship Journey in Azure b...apidays
 
Day 9 - PostgreSQL Application Architecture
Day 9 - PostgreSQL Application ArchitectureDay 9 - PostgreSQL Application Architecture
Day 9 - PostgreSQL Application ArchitectureBarry Jones
 
Building a REST API for Longevity
Building a REST API for LongevityBuilding a REST API for Longevity
Building a REST API for LongevityMuleSoft
 
INTERFACE by apidays_What's your Type? Understanding API Types and Choosing t...
INTERFACE by apidays_What's your Type? Understanding API Types and Choosing t...INTERFACE by apidays_What's your Type? Understanding API Types and Choosing t...
INTERFACE by apidays_What's your Type? Understanding API Types and Choosing t...apidays
 
Building Scalable Big Data Infrastructure Using Open Source Software Presenta...
Building Scalable Big Data Infrastructure Using Open Source Software Presenta...Building Scalable Big Data Infrastructure Using Open Source Software Presenta...
Building Scalable Big Data Infrastructure Using Open Source Software Presenta...ssuserd3a367
 

Ähnlich wie Your API is Bad and You Should Feel Bad (20)

APITalkMeetupSharable
APITalkMeetupSharableAPITalkMeetupSharable
APITalkMeetupSharable
 
Pragmatic REST APIs
Pragmatic REST APIsPragmatic REST APIs
Pragmatic REST APIs
 
Intro to Web Services - 2015 STC Summit talk
Intro to Web Services - 2015 STC Summit talkIntro to Web Services - 2015 STC Summit talk
Intro to Web Services - 2015 STC Summit talk
 
Web Planning an Effective Integration with a 3rd party API to Scale
Web Planning an Effective Integration with a 3rd party API to ScaleWeb Planning an Effective Integration with a 3rd party API to Scale
Web Planning an Effective Integration with a 3rd party API to Scale
 
Lessons learned on the Azure API Stewardship Journey.pptx
Lessons learned on the Azure API Stewardship Journey.pptxLessons learned on the Azure API Stewardship Journey.pptx
Lessons learned on the Azure API Stewardship Journey.pptx
 
REST API Recommendations
REST API RecommendationsREST API Recommendations
REST API Recommendations
 
Api crash
Api crashApi crash
Api crash
 
Api crash
Api crashApi crash
Api crash
 
Api crash
Api crashApi crash
Api crash
 
Api crash
Api crashApi crash
Api crash
 
Api crash
Api crashApi crash
Api crash
 
Api crash
Api crashApi crash
Api crash
 
Api crash
Api crashApi crash
Api crash
 
Building rich interface components with SharePoint
Building rich interface components with SharePointBuilding rich interface components with SharePoint
Building rich interface components with SharePoint
 
apidays LIVE Paris 2021 - Lessons from the API Stewardship Journey in Azure b...
apidays LIVE Paris 2021 - Lessons from the API Stewardship Journey in Azure b...apidays LIVE Paris 2021 - Lessons from the API Stewardship Journey in Azure b...
apidays LIVE Paris 2021 - Lessons from the API Stewardship Journey in Azure b...
 
Day 9 - PostgreSQL Application Architecture
Day 9 - PostgreSQL Application ArchitectureDay 9 - PostgreSQL Application Architecture
Day 9 - PostgreSQL Application Architecture
 
Building a REST API for Longevity
Building a REST API for LongevityBuilding a REST API for Longevity
Building a REST API for Longevity
 
INTERFACE by apidays_What's your Type? Understanding API Types and Choosing t...
INTERFACE by apidays_What's your Type? Understanding API Types and Choosing t...INTERFACE by apidays_What's your Type? Understanding API Types and Choosing t...
INTERFACE by apidays_What's your Type? Understanding API Types and Choosing t...
 
REST APIs
REST APIsREST APIs
REST APIs
 
Building Scalable Big Data Infrastructure Using Open Source Software Presenta...
Building Scalable Big Data Infrastructure Using Open Source Software Presenta...Building Scalable Big Data Infrastructure Using Open Source Software Presenta...
Building Scalable Big Data Infrastructure Using Open Source Software Presenta...
 

KĂźrzlich hochgeladen

Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024The Digital Insurer
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesBoston Institute of Analytics
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfhans926745
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel AraĂşjo
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...DianaGray10
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...apidays
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessPixlogix Infotech
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 

KĂźrzlich hochgeladen (20)

Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 

Your API is Bad and You Should Feel Bad

  • 1. SouthEast LinuxFest 2015 Your API is Bad and You Should Feel Bad Amanda Folson AmbassadorAwsum
  • 2. SouthEast LinuxFest Who am I to judge? • Associate Product Manager/Developer Evangelist at PagerDuty • Average consumer of APIs and IPAs • Well RESTed (you can boo at my pun) • Professional conference attendee and tinkerer 6/17/2015Your API is Bad and You Should Feel Bad
  • 3. SouthEast LinuxFest APIs are Everywhere 6/17/2015
  • 4. SouthEast LinuxFest Great, but why do I care? • Provides a uniform interface for interacting with your application • API allows you to shard off services – Decouples services – Website->API – Mobile->API • This is cool if you’re into SoA – I am. 6/17/2015
  • 5. SouthEast LinuxFest Types of Application Programming Interfaces • Language/Platform/Library APIs – Win32 – C++ – OpenGL • Web APIs – SOAP – XML-RPC – REST 6/17/2015
  • 6. SouthEast LinuxFest SOAP • Stateful • WS-Security • Mostly obvious procedures (getRecord, delRecord) – Need to know procedure name – Need to know order of parameters 6/17/2015
  • 7. SouthEast LinuxFest REST • Gaining adoption • HTTP-based (usually) • No need to know order of parameters in most cases • Can return XML, JSON, ? 6/17/2015
  • 8. SouthEast LinuxFest Sounds Good, Let’s Build 6/17/2015
  • 9. SouthEast LinuxFest “The best design is the simplest one that works.” 6/17/2015 Albert Einstein Your API is Bad
  • 10. SouthEast LinuxFest Slow Down • Don’t rush into v1, v2, etc. • Make sure you meet goals • Involve users/engineers from the start • This is hard 6/17/2015
  • 11. SouthEast LinuxFest IncrediBL Overview • DNSBL (lists IPs to blacklist) • Requires DNS servers – Lookups – Domain resolution • Requires database servers • Requires web servers • Requires patience 6/17/2015
  • 12. SouthEast LinuxFest Design • Immutable blueprint • Contract between you and users • SHARE – The worst feedback is the feedback you don’t hear • Account for existing architecture • Changes should provide actual value not perceived/potential value • Design for uniformity 6/17/2015
  • 13. SouthEast LinuxFest Know Thy Audience • Who is this for? – Us? Internal? – Them? Business partners/3rd parties? – ??? • What’s the incentive? 6/17/2015
  • 14. SouthEast LinuxFest Ask! • Stakeholders will tell you what they need • Regardless of version, feedback should make it into your spec • Build something people want 6/17/2015
  • 15. SouthEast LinuxFest Spec Tools • Apiary/API Blueprint • Swagger • RAML The list goes on… 6/17/2015
  • 16. SouthEast LinuxFest What is REST? • Representational State Transfer • HTTP-based routing and methods – PUT/GET/POST/etc. • Stateless – No sessions – HATEOAS 6/17/2015
  • 17. SouthEast LinuxFest Resources • /resource is a gateway to an area of your application – /users – /places – /things • CRUD actions can be performed on a single resource – GET vs getUser, getMessage, getThing • Use plural nouns, no verbs (GET, CREATE, etc.) – Can be for a single item or a collection of items 6/17/2015
  • 19. SouthEast LinuxFest GET • GET data from a /resource • You do this daily by browsing the web. Go you. • Uses query string to tell API what data to retrieve • Returns 200 if everything’s OK 6/17/2015
  • 20. SouthEast LinuxFest POST • Used to create/manipulate data • Relies on a message body being sent vs query string (XML, JSON, ?) • Returns 201 Created • Should return URI to newly created resource 6/17/2015
  • 21. SouthEast LinuxFest PUT • Update a resource • OVERWRITES EXISTING OBJECT WITH NEW ONE – You don’t have to allow this, be careful with this because its use is inconsistent across APIs, should be used consistently across resources – Return 201 created if you do this – Can’t use PUT within the resource itself (/messages) without an ID – PUT should never be use to wrangle partial updates 6/17/2015
  • 22. SouthEast LinuxFest PATCH • Updates only the properties provided in the call • 200 on successful update • 304 if nothing changed 6/17/2015
  • 23. SouthEast LinuxFest DELETE • Don’t allow on an entire collection (/users or /messages or /places) or limit it • 200 if item or collection was deleted • 204 if item or collection was deleted but there’s no body to return • 202 if request was accepted and deletion was queued (CDN, cache, etc.) 6/17/2015
  • 24. SouthEast LinuxFest OPTIONS • Not for interacting with data • Informs clients of available methods • Return 200 or 204 • You could also return 405 (Method Not Allowed) but why would you do that you monster? • Useful when method should work on items but not collections within a resource (don’t DELETE and collection of users or messages) 6/17/2015
  • 25. SouthEast LinuxFest Content Types • Be nice, return more than one – JSON and XML are common – Different clients have different needs – Easy to add new types as needed if you design for this early on • If you only allow one type, inform that others aren’t allowed • Use Content-type: to receive and parse client data • Can use Accept header to see what format client wants back • For simplicity you can just send back what they send 6/17/2015
  • 26. SouthEast LinuxFest Replying • Provide information on failures beyond HTTP status codes. – “API Key does not have access to modify resource” is better than 403 Forbidden alone – 200 OK, 201 Created, 204 No Content, 304 Not Modified, 5xx We Screwed Up, Not You – HTTP status codes let client decide what to do next – No true standardized error message format, but Google Errors and JSON API are trying 6/17/2015
  • 27. SouthEast LinuxFest HATEOAS • Hypermedia As The Engine Of Application State • Hypertext links to other resources (like links on a page) – Every object has actions to perform • Choose your own adventure for navigation/pagination – Give clients list of actions to take – Client tracks state – Server provides options to change state • HARD – Requires knowing possible ways to interact with object • Clients have to know how to handle this, some will hardcode anyway 6/17/2015
  • 28. SouthEast LinuxFest Hypermedia Specs • Wishful thinking • There are no standards for this • JSON API? Custom? HAL? • HAL/JSON API are good starting points with wide adoption 6/17/2015
  • 29. SouthEast LinuxFest Versioning • API is not the time to cowboy deploys/releases • Design so that you never have to version • Migrations are hard • Maintaining n versions • Deprecate carefully – Not everyone can update in a weekend 6/17/2015
  • 30. SouthEast LinuxFest When to Version • Backwards incompatible changes – Creating new data models • When your API no longer meets you or your users’ needs BUT NOT • When you add new resources or data fields 6/17/2015
  • 31. SouthEast LinuxFest Version in URI • https://api.myawesomestuff.com/v1/stuff • Version is obvious to users • Relative paths can’t always be hypermedia driven 6/17/2015
  • 32. SouthEast LinuxFest Version in Content-type • Content-type: application/json+v1 • Cleaner, not as obvious • Can default to a version if none is specified • Devs need to know that they need to send this 6/17/2015
  • 33. SouthEast LinuxFest Version in Custom Header • Version: 1 • MyApp: 2.6 • No standards • Requires GREAT docs • Confusing for users who aren’t expecting it 6/17/2015
  • 34. SouthEast LinuxFest Caching • Ssscccaaallleee • Cache on API client end • Cache-control header (public, expires-at, no-cache, max-age), Expires • Important that this info end up in docs/SDKs 6/17/2015
  • 35. SouthEast LinuxFest Authentication • Kill Basic Auth – Keep username/passwords safe • OAuth – Require users to explicitly authorize an app – Tricky for some people to implement – Restrict auth to HTTPS endpoints – Restrict domains allowed to auth – MITM attacks, make sure users store tokens well 6/17/2015
  • 36. SouthEast LinuxFest Security • Treat users as hostile • Don’t rely on single method • Apply layers of security – Permissions-based API keys/UAC • Per app, not per account. Will depend on your architecture – DNSBL – Content length/depth limits • ÂżRecursive? – SQL injection – Rate limit/throttling 6/17/2015
  • 37. SouthEast LinuxFest Prototyping • Laravel/Lumen, Flask, Rails, Mojolicious – RESTful HTTP routing – Zero to API in ~1hr • Specs – Apiary, Mockable, RAML – Frameworks allow importing of specs – Some spec tools can autogenerate SDKs for you (APIMatic) • Chrome REST API client, Postman, jsfiddle 6/17/2015
  • 39. SouthEast LinuxFest Maintenance • Plan to maintain API, SDKs, docs • Don’t launch and leave • Allocate maintenance resources • Community? Paid service? 6/17/2015
  • 40. SouthEast LinuxFest Things Bad People Do • Log in to view API docs – Counter to open source mentality to use docs as a lead generation tool • Use HTTP (needs more S) • No documentation • Require name/password in URL structure – Can be saved in browser/CLI which is very insecure 6/17/2015
  • 41. SouthEast LinuxFest SDKs • Nice when these are provided to users • Should have maintenance plan like API • Need to be kept in sync • Should be made by language experts 6/17/2015
  • 42. SouthEast LinuxFest Documentation • API is useless if no one knows how to use it • NEEDS to be part of design process • All inclusive – Errors/methods/parameters – Reference and tutorial – In sync with changes to API • Include how to get help • Open source is nice  6/17/2015
  • 43. SouthEast LinuxFest The best API is the one that exists. 6/17/2015Your API is Bad and You Should Feel Bad
  • 44. SouthEast LinuxFest /resources • Build APIs You Won’t Hate - Phil Sturgeon http://apisyouwonthate.com/ • Undisturbed REST - Mike Stowe http://mulesoft.com/restbook • Apiary – http://apiary.io • RESTful Web APIs - Leonard Richardson, Mike Amundsen, Sam Ruby 6/17/2015

Hinweis der Redaktion

  1. The best method is the one that results in an API that meets needs. SOME API is usually better than none.
  2. The idea is to build a solid foundation to build on, not to join the 9001 other people trying to get their API out the door ASAP.
  3. Picture shows some overlap which is encouraged and we’ll see why later on Before you dive in, keep in mind that the idea is to promote uniformity across the API
  4. Except in cases where this makes sense to use singular like /cart
  5. Tells the server what action you want to take Take advantage of HTTP methods/ Create, Read, Update, Delete
  6. This could be its own talk…
  7. Try to make as few API revisions as possible, high numbers men more versions to maintain!
  8. Users should be immersed within minutes, not hours
  9. Common mistake for people and companies to make, forces users to scrape HTML to get the data they want, in the end costs you more than just having an API
  10. This talk isn’t meant to be all encompassing, feel free to reach out if you want to chat some more. Happy to provide additional resources.