We have a ProductsAPI
to browse products available at our site which is consumed by our mobile Apps (Android & iOS). Following is the basic design:
URL: /api/products/
Response:
[
{
"id" : 123,
"name" : "abc",
"detailsUrl" : "/api/products/123"
},
{
"id" : 124,
"name" : "xyz",
"detailsUrl" : "/api/products/124"
}
]
Here, detailsUrl
contains the API URL for ProductDetails
page.
Now, we have a requirement to make some changes in the response of ProductDetails
API in new versions of apps and need to version it. The URL will be changed to - /api/v2/products/{id}
(we use API versioning through URL).
Since we do not want the new response in previous version of Apps, we need to create a new version of ProductsAPI
also which will send new ProductDetailsAPI
url in response.
The APIs are coupled this way. If we change version of any child API, parent API version also need to be changed. What is the recommended way to handle this issue? Should we change way of versioning our APIs (use headers or something)?