suresh
suresh

Reputation: 177

Restful versioning

In RESTful or any application versioning I see that versioning is done by adding version to URL of the endpoint, e.g.:

http://app/api/customers/1234
http://app/api/v3/customers/1234
http://app/api/v4/customers/1234

Does it mean that app is deployed to different servers and all three are maintained or how it is achieved?

Upvotes: 1

Views: 49

Answers (1)

Opal
Opal

Reputation: 84756

It depends. It may be handled twofold:

  1. Via the proxy server (e.g. nginx, apache) using the domain.

In this scenario proxy server recognizes the URL and using the version part of the domain decides where to forward the request. Basically, as far as I know, if the version is located in the path (e.g. http://app/api/v3/customers/1234) this scenario is rarely used. It's used more often if version is located in the domain (e .g. http://v3.app/api//customers/1234)

  1. In the application itself.

Application exposes all the endpoints and handles the version resolution internally.

No matter how it's handled you still need to synchronize the resources internally - in DB e.g.

Upvotes: 1

Related Questions