Best Practices for Building with External APIs Ben Greenberg @rabbigreenberg
Slide 2
or alternativelyβ¦
@rabbigreenberg
Slide 3
@rabbigreenberg
Becoming an API Explorer
Slide 4
Welcome to API Explorer Academy! π Our Mission β Discovering what to look for β Equipping with the right tools β Loving the journey, even with the bumps along the way! @rabbigreenberg
Slide 5
Before we start, who is this person talking to me?
β Professional API Wrangler (i.e. Developer Advocate) at Orbit β Ruby is my happy language β SAN π« JFK π« TLV π orbit.love
@rabbigreenberg
π§ ben@orbit.love
Slide 6
Bonus Slide!
Weβre hiring π β Globally distributed team β Remote first β Empathetic product-driven engineering β Enjoys space punsβ¦ sometimes
π orbit.love/careers
Slide 7
First of all⦠What is an API? @rabbigreenberg
Slide 8
ββ¦ when a company offers an API to their customers, it just means that theyβve built a set of dedicated URLs that return pure data responses β meaning the responses wonβt contain the kind of presentational overhead that you would expect in a graphical user interface like a website.β -
What is an API in Plain English
@rabbigreenberg
Slide 9
Examples of APIs β
Cat Facts - https://alexwohlbruck.github.io/cat-facts/
β
Harvard Art Museums - https://github.com/harvardartmuseums/api-docs
β
Google Books - https://developers.google.com/books/
β
Charity Search - http://charityapi.orghunter.com/
β
National Bank of Poland - http://api.nbp.pl/en.html
β
U.S. Street Address Validation - https://www.smartystreets.com/docs/cloud/us-street-api
β
Associated Press - https://developer.ap.org/
@rabbigreenberg
Slide 10
Youβre interested in an API? @rabbigreenberg
Slide 11
API Explorer Academy: Stage I
Initial Discovery
Slide 12
Your Investigation Checklist β
π π π π π π
API Reference Documentation Credentialing Rate Limits Pagination Support @rabbigreenberg
Slide 13
API Reference Why do you need an API reference?
@rabbigreenberg
Slide 14
βThe OpenAPI Specification (OAS) defines a standard, language-agnostic interface to RESTful APIs which allows both humans and computers to discover and understand the capabilities of the service without access to source code, documentation, or through network traffic inspection.β -
OpenAPI Introduction
@rabbigreenberg
Slide 15
What are the parameters? What does an error look like? What does success look like?
@rabbigreenberg
Slide 16
@rabbigreenberg
Slide 17
@rabbigreenberg
Slide 18
β Does it have an API reference? @rabbigreenberg
Slide 19
Documentation Is there documentation?
@rabbigreenberg
Slide 20
Can an API even be used without documentation⦠? -
Stoplight
Slide 21
Types of Documentation
π π π π π
Overviews Tutorials Quickstarts Code Snippets Use Cases @rabbigreenberg
Slide 22
Describe each status code
Soliciting feedback
Attributes with data types
Describe error types
@rabbigreenberg
Slide 23
β Does it have documentation? @rabbigreenberg
Slide 24
Credentials
Is it secure?
@rabbigreenberg
Slide 25
Authentication is Identity Authorization is Access @rabbigreenberg
Slide 26
API
π βI am who I say I am, please give me what I am asking for.β
π βI believe you are who you say you are, here is your data.β
APPLICATION
@rabbigreenberg
Authentication Protocols
π Basic Auth β Base64 encoded username and password
π API Key
β A key that identifies an authorized application
π OAuth
β User scoped authentication β Multi-step process @rabbigreenberg
Slide 29
Basic Authentication Example
@rabbigreenberg
Slide 30
API Key Example
@rabbigreenberg
Slide 31
OAuth 2.0 Client Credentials Flow 1
CLIENT
Send Client ID and secret to /token
4
2 Validate client ID and secret
Request data with token
3 Send token to client
API @rabbigreenberg
Slide 32
β How does it authenticate? @rabbigreenberg
Slide 33
Rate Limiting and Pagination Are there limits?
@rabbigreenberg
Slide 34
Rate Limiting is about requests Pagination is about records @rabbigreenberg
Slide 35
@rabbigreenberg
Slide 36
@rabbigreenberg
Slide 37
API Explorer Academy:Stage II
Pre-Flight Checks
Slide 38
Letβs check out this API! @rabbigreenberg
Slide 39
Experimenting with an API @rabbigreenberg
Slide 40
Why do we experiment?
β See Live Data β Check Assumptions β Do Something Wrong
@rabbigreenberg
Slide 41
@rabbigreenberg
Slide 42
Save requests to replay later
Examine the API response
@rabbigreenberg
Define parameters, authentication, headers and more
Slide 43
@rabbigreenberg
Slide 44
Authorization options: β β
API Key OAuth
Possible API responses: β β
200 401
@rabbigreenberg
Slide 45
@rabbigreenberg
Slide 46
API Explorer Academy: Stage III
Ready to Launch
Slide 47
You donβt have to do it alone @rabbigreenberg
Slide 48
Tools To Help You On Launch Day
β SDKs β Low-Code/No-Code Tools
@rabbigreenberg
Slide 49
What is an SDK? @rabbigreenberg
Slide 50
βSDK stands for software development kit. Also known as a devkit, the SDK is a set of software-building tools for a specific platform, including the building blocks, debuggers and, often, a framework or group of code libraries such as a set of routines specific to an operating system (OS).β IBM Introduction to SDKs
@rabbigreenberg
Slide 51
@rabbigreenberg
Slide 52
Stop worrying about the API @rabbigreenberg
Slide 53
Manages authentication
Handles rate limiting and pagination
@rabbigreenberg
Slide 54
APIs Can Introduce Breaking Changes Donβt Let Them Break You
@rabbigreenberg
Slide 55
Adding Activities to Orbit via the API directly You need to know: β Headers β Authentication β Data format (JSON) β Data types
All these are subject to change (often)!
@rabbigreenberg
Slide 56
Adding Activities to Orbit via the SDK
You need to know: β β
What your data is What method to call
@rabbigreenberg
Slide 57
β β
β
β β β @rabbigreenberg
Build workflows graphically Integrate with numerous services automatically Customer support
Build workflows graphically Add custom code solutions More programmer-oriented
Slide 58
API Explorer Academy: Stage IV
Creating Outposts
Slide 59
Celebrate your wins along the way @rabbigreenberg
Slide 60
Each new learning is another new outpost in your growth @rabbigreenberg
Slide 61
βInstead of specializing in speedometers or steering wheels, software supply chain companies deliver reusable chunks of code that developers bring together to make finished applicationsβ¦ @rabbigreenberg
Slide 62
These are called APIs⦠@rabbigreenberg
Slide 63
β¦ This shift to component software is the next big leap in the evolution of the software industry.β -
Jeff Lawson
@rabbigreenberg
Slide 64
Stay in Touch
ben@orbit.love @rabbigreenberg @bencgreenberg
@rabbigreenberg