3 Things to Consider before Versioning your API

The question of how to version your API is one with varied responses depending on who you ask. But, often times we probably jump the gun on this. A couple of things drive API changes and each may require a different approach to handle the scenario. Let’s look at a few

New API Attributes

This is straight forward. You need to add new attributes to your API. Instead of versioning your service all you need to do is make the new attributes optional. The documentation captures this change and your API is backward compatible for older apps or clients. No big deal here.

Attribute Deprecation

This situation is quite different from the first because removing a required attribute will break older clients which you don’t want. This situation requires more of a social solution than a technical solution. Just give your clients a time frame for which the attribute will be supported and communicate it clearly, using documentation, your website and social media.

A combination of this and the first approach can be seen as an expand and contract approach where you may add a new attribute which might replace two other attributes (expand) and then remove the two older attributes at a predetermined time (contract).  These scenarios once again allow you get by without API versioning.

Resource Creation

Maybe the changes you are about to make actually imply a new and different API after all. It could be a new resource created to handle some level of aggregation required in certain scenarios. Which ever the case, new resource creation is what is called for and not API versioning.

If none of these scenarios really meet what you are trying to accomplish it is possible you do need to version your API. Different approaches to doing that will be discussed in separate post. At the very least, it does make sense to pause and reflect on the end goal. What else do you consider before deciding to version for your API?

Lessons From the ‘The Power of Habit’ by Charles Duhigg

This is probably one of the most impactful and practical books I went through in 2014. Everyone knows a thing or two about habits: good and bad. Just how exactly do you form a habit or break a bad one?

The author starts off by laying out the habit loop

Cue -> Routine -> Reward

Essentially, some cue initiates a routine, with some reward afterwards which makes the outcome of the routine satisfying. Cravings are what power this loop.

So basically, to create a new habit you just need to find an obvious cue and clearly define a reward. An example could be: lay out your gym clothes by your bed, so you wake to see it when you wake up in the morning (Cue). Go running (Routine). Drink a smoothie after your workout (Reward). You can fill in the blank, but that’s the basics of building a new habit.

Overcoming a bad habit? A little trickier. We need to first understand what craving is driving that specific behavior. Sometimes, it’s about remaking the habit by leaving the cue and reward as is, but changing the routine. This could be taking fruits to snack on when the craving for vending machine junk comes on around 3pm.

Interestingly enough the author highlights how personal belief, group support and accountability goes a long way. Want to stick with your new workout habit, get a workout partner.

Sometimes, breaking a bad habit can me more elusive and it’s critical to make sense of what craving is driving the habit loop. So these steps help

  • Identify the routine: The habit itself
  • Experiment with different rewards: To identify the craving
  • Isolate the cues: To Identify the cue by Paying attention to:
    • Location – Is this habit usually triggered at a specific place?
    • Emotional State – Is there a feeling that usually precedes the routine?
    • Time – Does this habit usually occur at a specific time of the day?
    • People – Are there specific people around you when this habit is on display?
    • Action – Is there a specific action that precedes the urge?

Being more aware of what makes up the habit loop goes a long way to tackling any habit. So, go ahead and take the first step towards breaking or making that habit.

 

 

Create a free website or blog at WordPress.com.

Up ↑