-4

I want to extend our api to a (better) v2 version. I came up with the plan of adding a "v2" area and under that, cloning each controller into it. (basically v1 sometimes returns json, sometimes text, sometimes ysod and we're standardising our responses). So we now support both v1 and v2 via:

v1 "abc.com/billing" <- same as it's always been

v2 "abc.com/v2/billing" <- new v2

I've been having trouble with routing to two identically named controllers, but I think it's fixable. is this idea (i.e. using Areas) a good one or have I missed a trick? I like the idea of using Areas because I think it scales well when we move to v3. Thanks


thanks for the suggested duplicate, but what I'm after is a way to achieve a desired routing using either Areas or other means. It is an api, but hopefully the question still stands if I wanted to route to two different, but identically named controllers.

timB33
  • 191
  • 1
  • 7
  • For your specific situation you may be able to support the HTTP `Accept`-header and sent the resource in the format the client requests. This doesn't solve the general versioning problem. – Kasper van den Berg Oct 06 '19 at 08:38
  • Search for api versioning here on software engineering. – Kasper van den Berg Oct 06 '19 at 08:41
  • 1
    Possible duplicate of [Versioning REST APIs. Each API has its own version](https://softwareengineering.stackexchange.com/questions/356433/versioning-rest-apis-each-api-has-its-own-version) – Kasper van den Berg Oct 06 '19 at 08:42

1 Answers1

0

I'm wrong. the duplicate answer links to Troy hunt, who's got a decent answer. Thanks https://www.troyhunt.com/your-api-versioning-is-wrong-which-is/

timB33
  • 191
  • 1
  • 7