SlideShare a Scribd company logo
API Versioning in the
Cloud
Presented to
Who am I?
Travis McChesney
Senior Engineer at Cloud Elements
travis@cloud-elements.com
@CloudElements1
Application Level
Consumer
Application
(Facets)
Custom Business
Logic
(Extension)
API
C++ (or anything, really) C#
Object Oriented
Creator & Consumer
REST
Creator
Your Super Cool App
Cloud Elements
CE Messaging API
SendGrid
TwilioTwilio API
SendGrid API
Themes
• API Versioning
• API Documentation / Resources
• Different Services,
Different Architectures
API Versioning
• Content Negotiation
• URI
• URI Parameter
Content Negotiation
Accept: application/json
Cookie: Cookie: $Version=1; Skin=new;
Authorization: Authorization: Basic
QWxhZGRpbjpvcGVuIHNlc2FtZQ==
• HTTP Header Field Examples
MIME type
Content Negotiation
http://elements/messaging/search
{
text: "Galvanize",
elementToken:
"d39716cff276e1665ebf1ec4c270ee0a"
}
Content Negotiation
===>
POST /elements/messaging/search HTTP/1.1
Accept: application/ce.messaging.sg+json
...
<===
HTTP/1.1 200 OK
Content-Type: application/ce.messaging.sg+json
...
"records":[{ from:"travis@cloud-elements.com",
status:"sent",
recipients:"gary@cloud-elements.com", ...}]
Content Negotiation
<===
HTTP/1.1 200 OK
Content-Type: application/ce.messaging.sg+json
...
"records":[{ from:"travis@cloud-elements.com",
status:"sent",
recipients:"gary@cloud-elements.com",
priority:"normal", ...}]
Content Negotiation
<===
HTTP/1.1 200 OK
Content-Type: application/ce.messaging.sg-v2+json
...
"records":[{ from:"travis@cloud-elements.com",
status:"sent",
recipients-email:"gary@cloud-
elements.com" }]
===>
POST /elements/messaging/search HTTP/1.1
Accept: application/ce.messaging.sg-v2+json
...
Content Negotiation
Advantage
• No version clutter in URI
Disadvantage
• Header data availability
API Versioning
 Content Negotiation
• URI
• URI Parameter
URI
http://elements/messaging/search
http://elements/v2/messaging/search
http://elements/v2.0/messaging/search
• Alias latest API version to permanent
resource
URI
http://elements/v1.0/messaging/search
http://elements/v1.1/messaging/search
http://elements/v1.2/messaging/search
http://elements/messaging/search
• Redirect outdated resources
URI
http://elements/messaging/search
"records":[{ from:"travis@cloud-elements.com",
status:"sent",
recipients-email:"gary@cloud-
elements.com",
priority:"normal" }]
URI
http://elements/v1.0/messaging/search
"records":[{ from:"travis@cloud-elements.com",
status:"sent",
recipients:"gary@cloud-elements.com"
}]
URI
• Version number considerations
• [Major].[Minor].[Revision] (e.g. v1.5.1)
• Major:
• Significant business rule changes
• Fundamental API changes
• Minor:
• Change of representation (moving from
"recipient" to "recipient-email")
• Revision: Property addition (adding "priority")
URI
• Maintenance considerations
• Each version hosted separately
• Support for older versions
URI
Advantage
• Widely used
Disadvantage
• Version clutter in URI
API Versioning
 Content Negotiation
 URI
• URI Parameter
URI Parameter
http://elements/messaging/search
http://elements/messaging/search?v=1.5
API Versioning
 Content Negotiation
 URI
 URI Parameter
So now what?
http://www.lexicalscope.com/blog/2012/03/12/how-are-rest-apis-versioned/
It's up to you!
API Documentation
programmableweb.com
Swagger
http://developers.helloreverb.com/swagger/
Different Services,
Different Architectures
(Cloud Elements Demo)
Your Super Cool App
Cloud Elements
CE Messaging API
SendGrid
TwilioTwilio API
SendGrid API

More Related Content

PPTX
Cloud Elements Documents Hub
PPTX
Building Push Triggers for Logic Apps
PPTX
Inside Logic Apps
PDF
O365Con18 - Automate your Tasks through Azure Functions - Elio Struyf
PPTX
Microservices and Azure App Services
PPTX
Connect the Impossible with Azure Logic App
PPTX
2015-12-02 - WebCamp - Microsoft Azure Logic Apps
PPTX
Integration of mule esb with microsoft azure
Cloud Elements Documents Hub
Building Push Triggers for Logic Apps
Inside Logic Apps
O365Con18 - Automate your Tasks through Azure Functions - Elio Struyf
Microservices and Azure App Services
Connect the Impossible with Azure Logic App
2015-12-02 - WebCamp - Microsoft Azure Logic Apps
Integration of mule esb with microsoft azure

What's hot (20)

PPTX
Integrating SaaS application using Microsoft’s Azure App Service Platform
PPTX
Clean up this mess - API Gateway & Service Discovery in .NET
PPTX
Integration Tales: Logic & API apps to the rescue!
PPTX
CTU June 2011 - Windows Azure App Fabric
PPTX
API Design- Best Practices
PPTX
Web API authentication and authorization
PPTX
Microservices and the Cloud based future of integration final
PPTX
ASP.NET Web API
PPTX
Azure cloud patterns and architecture
PDF
Amazon API Gateway
PPTX
Azure Functions - Introduction
PPTX
ASP.NET MVC 5 and SignalR 2
PPTX
Serverless Architecture
PPTX
Api RESTFull
PDF
apidays LIVE New York 2021 - Introduction to HATEOAS with Ketting by Evert Po...
PDF
Developing scalable enterprise serverless applications on azure with .net
PPTX
The Hitchhiker’s Guide to Hybrid Connectivity
PPTX
Azure app service to create web and mobile apps
PPTX
Hybrid Integration with SAP
PPTX
Microservices in GO lang
Integrating SaaS application using Microsoft’s Azure App Service Platform
Clean up this mess - API Gateway & Service Discovery in .NET
Integration Tales: Logic & API apps to the rescue!
CTU June 2011 - Windows Azure App Fabric
API Design- Best Practices
Web API authentication and authorization
Microservices and the Cloud based future of integration final
ASP.NET Web API
Azure cloud patterns and architecture
Amazon API Gateway
Azure Functions - Introduction
ASP.NET MVC 5 and SignalR 2
Serverless Architecture
Api RESTFull
apidays LIVE New York 2021 - Introduction to HATEOAS with Ketting by Evert Po...
Developing scalable enterprise serverless applications on azure with .net
The Hitchhiker’s Guide to Hybrid Connectivity
Azure app service to create web and mobile apps
Hybrid Integration with SAP
Microservices in GO lang
Ad

Similar to API Versioning in the Cloud (20)

PDF
Simplify QA Automation: Master API Testing with HTTPClient in C#
PPTX
API-Driven Relationships: Building The Trans-Internet Express of the Future
PPTX
Enjoying the Move from WCF to the Web API
PPTX
ASP.NET Mvc 4 web api
PDF
Getting Started with Globus for Developers
PDF
Kubernetes One-Click Deployment: Hands-on Workshop (Mainz)
PPTX
Basics Of Introduction to ASP.NET Core.pptx
PPT
Introduction to the Client OM in SharePoint 2010
PDF
Architecting &Building Scalable Secure Web API
PPTX
What's new for Developers in SharePoint 2013
PDF
GlueCon 2018: Are REST APIs Still Relevant Today?
PPTX
Mastering Authorization: Integrating Authentication and Authorization Data in...
PDF
Leveraging APIs from SharePoint Framework solutions
PPTX
gRPC, GraphQL, REST - Which API Tech to use - API Conference Berlin oct 20
PDF
Building a Great Web API - Evan Cooke - QCON 2011
PDF
Kubernetes Architecture - beyond a black box - Part 1
PPTX
Building multi tenancy enterprise applications - quick
PPTX
Lessons learned using Firebase in Production
PDF
Real Time Serverless Polling App
PPTX
Developing Apps with Azure AD
Simplify QA Automation: Master API Testing with HTTPClient in C#
API-Driven Relationships: Building The Trans-Internet Express of the Future
Enjoying the Move from WCF to the Web API
ASP.NET Mvc 4 web api
Getting Started with Globus for Developers
Kubernetes One-Click Deployment: Hands-on Workshop (Mainz)
Basics Of Introduction to ASP.NET Core.pptx
Introduction to the Client OM in SharePoint 2010
Architecting &Building Scalable Secure Web API
What's new for Developers in SharePoint 2013
GlueCon 2018: Are REST APIs Still Relevant Today?
Mastering Authorization: Integrating Authentication and Authorization Data in...
Leveraging APIs from SharePoint Framework solutions
gRPC, GraphQL, REST - Which API Tech to use - API Conference Berlin oct 20
Building a Great Web API - Evan Cooke - QCON 2011
Kubernetes Architecture - beyond a black box - Part 1
Building multi tenancy enterprise applications - quick
Lessons learned using Firebase in Production
Real Time Serverless Polling App
Developing Apps with Azure AD
Ad

More from Cloud Elements (20)

PDF
10 Step Guide to API Integrations
PDF
How to Build Platforms, Not Products
PDF
State of API Integration Report 2017
PDF
Cloud Elements | State of API Integration Report 2018
PPTX
All Things API Presentation - Gordon Weakleim [HomeAway]
PDF
Atlassianconnectadd onsforeveryplatform-tanguycrusson-140925195129-phpapp01
PDF
Email As A Datasource
PDF
Lean Product Development 101
PPTX
Building Event Driven API Services Using Webhooks
PPTX
Lean Product Development 101
PPT
'Scalable Logging and Analytics with LogStash'
PDF
The Entrepreneurial Methodology: How engineers can harness the madness in a n...
PPTX
Data normalization across API interactions
PDF
Filtering From the Firehose: Real Time Social Media Streaming
PPTX
Lean Product Development for Startups- Denver Startup Week
PPTX
Appx for Developers
PPTX
Lean product development for startups
PDF
Using a simple Ruby program to interface with quickly provisioned cloud appli...
PDF
Money & Bitcoin & the Cloud: It's all just data streams, anyway!
PPTX
Choosing a PaaS for the Enterprise
10 Step Guide to API Integrations
How to Build Platforms, Not Products
State of API Integration Report 2017
Cloud Elements | State of API Integration Report 2018
All Things API Presentation - Gordon Weakleim [HomeAway]
Atlassianconnectadd onsforeveryplatform-tanguycrusson-140925195129-phpapp01
Email As A Datasource
Lean Product Development 101
Building Event Driven API Services Using Webhooks
Lean Product Development 101
'Scalable Logging and Analytics with LogStash'
The Entrepreneurial Methodology: How engineers can harness the madness in a n...
Data normalization across API interactions
Filtering From the Firehose: Real Time Social Media Streaming
Lean Product Development for Startups- Denver Startup Week
Appx for Developers
Lean product development for startups
Using a simple Ruby program to interface with quickly provisioned cloud appli...
Money & Bitcoin & the Cloud: It's all just data streams, anyway!
Choosing a PaaS for the Enterprise

Recently uploaded (20)

PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PPTX
Programs and apps: productivity, graphics, security and other tools
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
DOCX
The AUB Centre for AI in Media Proposal.docx
PDF
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PDF
Approach and Philosophy of On baking technology
PDF
KodekX | Application Modernization Development
PDF
Network Security Unit 5.pdf for BCA BBA.
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PPTX
Understanding_Digital_Forensics_Presentation.pptx
Digital-Transformation-Roadmap-for-Companies.pptx
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
Programs and apps: productivity, graphics, security and other tools
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
The AUB Centre for AI in Media Proposal.docx
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
Agricultural_Statistics_at_a_Glance_2022_0.pdf
Approach and Philosophy of On baking technology
KodekX | Application Modernization Development
Network Security Unit 5.pdf for BCA BBA.
Building Integrated photovoltaic BIPV_UPV.pdf
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
20250228 LYD VKU AI Blended-Learning.pptx
Chapter 3 Spatial Domain Image Processing.pdf
The Rise and Fall of 3GPP – Time for a Sabbatical?
Per capita expenditure prediction using model stacking based on satellite ima...
NewMind AI Weekly Chronicles - August'25 Week I
Diabetes mellitus diagnosis method based random forest with bat algorithm
Understanding_Digital_Forensics_Presentation.pptx

API Versioning in the Cloud

Editor's Notes

  • #4: As you know, APIs aren’t just web based. It’s just an Application Programming Interface.At my previous job I worked with non-web-based APIs. There was a large program called Facets (an insurance payer program written in C++), and I would use the exposed API to create extensions (written in C#) that execute custom business logic. So, in this case, we were mixing languages, and the exposed API made it possible (through COM).
  • #5: In object oriented design, essentially every object you create will have its own API. The methods that are exposed are the API, and the objects have behavior and state which dictate what happens when the API is used. I have some experience with Objective-C, writing iOS apps. APIs are a huge part of creating anything in an object oriented language, and especially in iOS. Every object exposes an API that consumers utilize to get things done.
  • #6: Most recently, I have been working at Cloud Elements where we deal with web based APIs, and more specifically, REST APIs. Our core product is built to expose a set of APIs that allow consumers to use the underlying service easily, and in a language agnostic way.
  • #7: This is a high level look at what the Cloud Elements product does. It exposes a common API to each of its “hubs”. A hub is something like messaging services or payment services.In the example here, my super cool app, written in any language that can talk to a RESTful API, calls the common Messaging hub API. The hub then determines, based on current settings, which third party API to use to service the request.That determination can be made on things like which service is up or down; which service is least expensive, etc.
  • #8: API Versioning: What happens when my API changes? How can I help clients deal with those changes, and what&apos;s really involved?API Documentation: Jeff didn&apos;t really mention this, but thought it fit well with the versioning aspect, and its usefulness overall.Different services, different architectures. What I mean by that is, the nature of APIs in general really lend themselves to a black box type of interaction between services. An API exposes an interface with a defined input and output, and what happens behind the curtains is largely unknown to us. It could be an Apache web server talking to a Tomcat app server, with Java and postgresql in the backend. It could be an email sent to someone who manually types in a response  right? We just don&apos;t know, or really care, what the underlying architecture is of the API services we utilize, nor does it matter. So, I&apos;ll show a demo of the Cloud Elements product near the end that illustrates that point.
  • #9: There are three main ways to accomplish API versioning. Content Negotiation, URI, and using a URI Parameter.
  • #10: Content negotiation refers to the HTTP Header that indicates what the client is asking for from a content perspective. Who knows what an HTTP header is? Have you learned about that?HTTP Header: Message header of requests and responses in the Hypertext Transfer Protocol (HTTP). They define the operating parameters of an HTTP transaction. So, whenever you browse to a web page, these header values are set by the browser and shipped off to the server. You don&apos;t see them, normally, but they&apos;re there. Common fields in the header are things like Accept (Content-Types that are acceptable for the response; Accept: text/plain), Cookie (previously stored cookie), and Authorization (credentials).So, for example, the Cloud Elements API, which we&apos;ll see later, accepts json, and it returns json. That Accept header value tells the server what type of content the client is expecting.Who has heard of a MIME type? It&apos;s an identifier for file formats on the internet.
  • #11: So let&apos;s say we have an API that lives at elements/messaging/search, that it&apos;s a POST request, and the input takes json with two properties, text and elementToken.
  • #12: This is what the header might look like for that request.To use content negotiation for versioning, we would need to use a vendor MIME media type, which is essentially a MIME type specifically for our API. Here we have something like ce.messaging.sg+json, which is a type specific to our messaging, SendGrid API.The request is made initially as a POST request, with the input parameters (not listed) for a messaging search. The response we get back shows the content type that we requested, and it&apos;s just json data.
  • #13: What if at some point we wanted to add a priority field to the json data? If the documentation for our specific MIME type says to ignore all unrecognized elements, then we can safely add it to the output, and existing clients should be fine with that.However, what happens if we want to change the recipients field to recipients-email? That&apos;s going to break existing clients, and we don&apos;t want to do that.
  • #14: What we can do is create a new revision of the MIME media type that tells our application whether or not the recipient knows about this field change.If we see the ce.messaging.sg-v2+json Accept header value in our server code, we know exactly how to handle the request, and the resulting output.
  • #15: Advantages:There is no versioning to clutter up the URI. There&apos;s always just one resource URI, and the versioning is determined by the header data.Disadvantage:- Some clients may not be able to access the HTTP header data easily, or at all. This is one reason, I believe, why many well known APIs (Netflix, Paypal, Drop Box) don&apos;t use this method. URI versioning is more widely compatible.
  • #16: Next we&apos;ll discuss API versioning using the URI. This is where we place the version number of the API in the URI itself.
  • #17: When I say URI versioning, I&apos;m referring to putting the version number in the URI itself.When using URI for API versioning, it is recommended by some to point the permanent API resource to the latest API version. So, all of the URIs listed here would be aliases of each other, assuming version 2 was the latest API version.
  • #18: If a client attempts to use an outdated version of the API, the request could be redirected to the permanent resource. The status code of the redirect can be used to indicate that the requested resource version is no longer supported. It is obviously up to you to determine how long to continue supporting each version, as you may want to support the last few, which is still fine.
  • #19: So, using our previous example, the permanent URI resource would be pointing to the latest version, where priority is present, and the recipient property has changed to recipient-email.
  • #20: The previous version would still return our original representation.
  • #21: The previous version would still return our original representation.
  • #22: The maintenance for the URI scheme will most likely involve hosting a new installation of the API application with each new revision. It may sound like a lot of work, but really if you install a new version, the old one will not be updated, so it can sit out there until you decide to stop supporting it. So, when do we stop supporting older versions? Typically, when a new minor version is released, the older versions will most probably need to stop being supported. This is because, with minor revisions, we&apos;ve changed the structure of how clients interact with the API, so it makes sense that there would be back end changes we just can&apos;t continue supporting.
  • #23: One of the advantages of URI based versioning is that it&apos;s very widely used. APIs like Tumblr, Groupon, and Drop Box, just to name a few, all use URI versioning with their APIs. Additionally, there&apos;s no need to rely on the client&apos;s ability to access HTTP header data when generating an API call.The disadvantage is that the URI now includes the version number, and it&apos;s possible that clients will be more difficult to maintain when switching between versions.
  • #24: Next we&apos;ll discuss API versioning using the URI. This is where we place the version number of the API in the URI itself.
  • #25: URI Parameter versioning is accomplished by sending a version query string parameter in with the API request. Just like the URI method, we can have the permanent URI, without a version parameter, just use the most recent version. Or, if a version parameter is sent in for a previous, supported, version of the API, we can route the request accordingly.Essentially everything I mentioned about the URI versioning method holds true for the URI Parameter method. There are several big name APIs that use this method (Netflix, Paypal).
  • #26: That covers the primary methods of accomplishing API versioning.
  • #27: So what do you choose? The answer is that it&apos;s completely up to you. There&apos;s no right or wrong answer to which method you choose, how long you support each version, or how you roll out new versions.A website that really helped me pull this together is from lexicalscope.com
  • #28: The next topic I want to discuss is the actual documentation of your API once it&apos;s up and running. This is a very important part of the process, since without great documentation, nobody will know how to use your API, and nobody will actually want to use it.When putting together your documentation, you can think of these 4 main areas that you want to cover. Thanks to Programmable Web for this handy diagram.I&apos;ll show you a couple of nice tools that we use at Cloud Elements to provide developers as much help as possible in getting started with our APIs.
  • #30: The last topic that I&apos;ll discuss relates to something Jeff mentioned in our conversation. Essentially, when thinking of APIs, we can think of them as the language of the internet. They&apos;re what glue services together throughout the web. One thing we notice is that, when we have an API to interact with, we most likely have no idea what&apos;s happening behind the scenes to make that API work. So, the implementation details of any given API are really unknown to us. Thought of another way, we can think of our own APIs. It doesn&apos;t really matter what technologies we use to make them work, as long as they fulfill the contract of the API.
  • #31: Here&apos;s another look at what the Cloud Elements API is all about. We have hubs such as messaging and payment that provide a uniform API into the underlying services. In the case of the messaging hub, your super cool app makes an API call into the Cloud Elements API, and that call is routed to SendGrid, or Twilio, or MailChimp, or anything that we have an element for. What&apos;s great is that no matter what service you&apos;re using on the back end, be it SendGrid or Twilio, your super cool app does not have to change. It will still call the same Cloud Elements API.So, let&apos;s take a look at how that works. I&apos;ll show a quick demo of the Cloud Elements messaging API that we&apos;ve sort of been using as examples all along. It&apos;s a pretty cool way to show that using a single API, we can access separate services that likely have very different implementations.What&apos;s the first thing you notice about the URI? It uses URI based versioning. In our case, it&apos;s actually in two places. One for the overall API, and one for the hub that we&apos;re using. If we were using content negotiation, we&apos;d add a Header value in Postman with the necessary MIME type.