URI-based Versioning for AWS API Gateway

后端 未结 1 1940
一生所求
一生所求 2021-02-19 09:42

I am struggling to understand how AWS API Gateway wants me to organise my APIs such that versioning is straightforward. For example, let\'s say I have a simple API for getting w

相关标签:
1条回答
  • 2021-02-19 10:10

    Do not create the version path (/v1) as a resource in your API. Instead, simply call you API "Names V1" and start creating the resources (/names). When you want to make a breaking change and create a new version of the API, we recommend you create an entirely new API called "Names V2". Once again, simply create your resources without the version path.

    To bring the two APIs together, you can use custom domain names. A custom domain name in API Gateway includes both a fully qualified domain name and a base path. Create two custom domain names:

    • myapi.com/v1 -> points to the prod stage of the Names V1 API
    • myapi.com/v2 -> points to the prod stage of the Names V2 API

    This way you can keep bug-fixing v1 while making changes to v2 and deploy the two APIs independently. The custom domain name will bring them together and make them appear under the same domain (myapi.com/v2/names).

    Hope this helps.

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