Versioning your APIs in Apigee: best practices and options

3 2 4,680

This is a question that comes up a lot during my discussion with prospects. And rightly so, since versioning is a very common and a real concern for any API Program. The whole premise of being Digital is that, it is really hard for you to get all your end users upgraded to the latest version of your app, let alone getting all the different partners and their end customers honoring your end of life notices.

Even before getting into versioning use cases that I have seen across various API programs I wanted to talk about analytics and API products.

Analytics is a very powerful tool, to give you visibility into how the usage has been for the API across different version. You can create custom reports that can tell you which developer, which developer app is using the older version of the API.

API Products can be leveraged effectively to restrict the newer apps being built, either by you or your partners from using the older versions of the API. Even if they have to use the older version of the API, you can put appropriate rate limits at the product level to give them an incentive to move to the newer versions of the API.

Beyond these best practices, at a high level, I’ve seen these four standard versioning use-cases with respect to API versioning itself:

1. Backend Supports multiple versions, Apigee does a pass through

This is a straightforward case, where the API Provider supports multiple backend versions and Apigee has to just pass them through. The only value add Apigee brings on to the table is visibility, in terms of how various versions are being used.

2. Backend Supports multiple versions, Apigee routes to the appropriate version

This is more of a content/context based routing - where Apigee can route the request to the appropriate version. This routing can be done based on a logic that Gateway can apply on the incoming request based on various parameters like URL/Query Paramaters/headers/payload elements/client ip/authentication information etc.

This will give a flexibility on how you manage the versions at the backend (like changing the url paths, moving them to new hardware etc)

3. Backend supports one version, Apigee does the mediation

In cases where it is expensive to manage multiple backend versions, Apigee can mediate the request/responses. That way, the backend gets the request in a way it understands, and the clients get the response in the way they expect. This is recommended as long as the mediation rules are straightforward (and simple).

4. Apigee gives an error for API requests for older versions

In cases where maintaining older versions is not viable and the transformation rules can become very complex (this happens when most of your clients update themselves to newer versions), Apigee can give a (meaningful) error response to the clients who still use the old version (that the provider stopped supporting)

This can also be done is a phased manner where

Phase 1 - Apigee adds a header or some other non intrusive way- to tell the developer that the API will be depriciated

Phase 2 - Apigee can introduce stringent rate limits on older version

Phase 3 - Apigee can block the requests and send the appropriate error message

Feel free to leave your comments and experience with API versioning.

Comments
Not applicable

Sunsetting of an API / older version without losing traffic is one of main challenge faced by any API team and last use case provides an effective solution to this perennial problem.

Also, this post showcase the strength of Analytics by pin-pointing which Apps are consuming deprecated API version so that focused effort can be made for migration.

One point, definitely, I would like to add is significant role Developer Portal can play in this context by:

1. Highlighting benefit of latest version so that developers see benefit in migration

2. Advertising support plan for deprecated API version

3. To avoid further adoption, remove support of deprecated version from API console and

4. Archiving the content related to the deprecated version.

Not applicable

I am working on the 3rd option where backend supports one version and mediation needs to be done on apigee.

I am wondering if it can be done in a way where the maintenance issues will be minimum.

Currently versioning is part of BasePath variable of a proxy endpoint.

For new version, I am planning to creating a new proxy endpoint (with different BasePath) and target endpoint, use as many existing policies as possible (creating new policies as and when necessary).

Is there a better way to do this? Because the only difference between old and new endpoints is the BasePath. So whenever there is any change in any flow, I have to change in both the places.

Suggestions on any better way to do use the 3rd option are welcome.

Version history
Last update:
‎03-31-2015 09:59 AM
Updated by: