Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does Apiary.io and/or API Blueprint support api versioning?

Does api blueprint or Apiary.io support the notion of versioning your API? In particular, I'm versioning my API via the URI like this:

GET /api/v2/SomeResource/

In the example above, this means I'm calling version 2 ("v2") of the API. Does api blueprint support this? How can I document multiple versions of a given action or the entire API?

like image 362
jakejgordon Avatar asked Sep 06 '15 02:09

jakejgordon


People also ask

Do you really need API versioning?

APIs only need to be up-versioned when a breaking change is made. Breaking changes include: a change in the format of the response data for one or more calls. a change in the request or response type (i.e. changing an integer to a float)

What is API version control?

API versioning is the practice of transparently managing changes to your API. Managing an API boils down to defining and evolving data contracts and dealing with breaking changes. The most effective way to evolve your API without breaking changes is to follow effective API change management principles.

How does Apiary work?

An apiary (also known as a bee yard) is a location where beehives of honey bees are kept. Apiaries come in many sizes and can be rural or urban depending on the honey production operation. Furthermore, an apiary may refer to a hobbyist's hives or those used for commercial or educational usage.

What is APIB file?

API Blueprint is a high-level language for describing web APIs. The syntax is a combination of Markdown syntax and Markdown Syntax for Object Notation (MSON), and the files are saved with a . apib extension.


1 Answers

You can use HOST header to signify that:

HOST: http://example.com/api/v2 is going to prefix all resources with /api/v2.

In the API Blueprint, if you use URL prefixing, the APIs are considered different and therefore you should use different blueprints for them.

If you use media types with version suffix to do that, you can just specify proper Content-Type in headers, and they'll be used properly for content negotiation in mock server.

like image 81
Almad Avatar answered Oct 18 '22 03:10

Almad