API Versioning for Rails Routes

前端 未结 7 651
独厮守ぢ
独厮守ぢ 2020-12-04 04:12

I\'m trying to version my API like Stripe has. Below is given the latest API version is 2.

/api/users returns a 301 to /api/v2/users

<
相关标签:
7条回答
  • 2020-12-04 05:12

    If at all possible, I would suggest rethinking your urls so that the version isn't in the url, but is put into the accepts header. This stack overflow answer goes into it well:

    Best practices for API versioning?

    and this link shows exactly how to do that with rails routing:

    http://freelancing-gods.com/posts/versioning_your_ap_is

    0 讨论(0)
提交回复
热议问题