CLOUD BLOG

March 21, 2017
3 min read

Swapping version and context in API URLs

By default, APIs published in WSO2 API Cloud get URLs like http://{base-gateway-URL}/{API context}/{API version}/{API resources and parameters}. For example, if the custom URL that you assigned to your gateway is api.my.domain, you might get something like http://api.my.domain/stats/1.0/countries/us. But what if you want to place the version number first and have something like http://api.my.domain/1.0/stats/countries/us instead? This is trivial too. Simply type {version}/stats (or whatever your API context is) instead of just stats as the context on the first step of API creation: And you can remove the version number altogether by selecting the Make this the Default Version checkbox on the 3rd step of API creation: WSO2 API Cloud is a powerful API management platform that allows you to easily create the exact API program you need!