Seagull
Seagull

Reputation: 2309

Do I create a new version of a REST API, if my JSON response has an extra element?

I am new to designing REST APIs, so excuse my ignorance in this matter. If I add a new element to my existing JSON response, does that mean I need to have a new version for that REST api?

Upvotes: 1

Views: 475

Answers (1)

Matti Virkkunen
Matti Virkkunen

Reputation: 65166

It depends on how you define your versioning scheme.

If you have a detailed version number with a major and minor version it's good to increment it whenever something changes so that you have something to refer to. In most cases adding a field should be backwards compatible, so incrementing a minor version number should be fine.

However by far most web APIs I have seen only define major versions which are incremented only when there's a non-backwards compatible change, and in that case I wouldn't increment it.

If you're writing proper documentation you could always clearly state what constitutes a non-breaking change that might occur without a version bump.

Upvotes: 2

Related Questions