Reputation: 1046
I have decided to transfer web API application to a subdomain, and I need to make stable all old android and ios Applications who use those APIs how can I redirect with param in post method like this :
to :
or what is the best solution to solve this problem
Upvotes: 0
Views: 545
Reputation: 239440
This is a breaking change. You can have the first URL issue a 301 Moved Permanently redirect, but there is no way to recover the post. The client must notice this response status code, check the Location
header for the new URL, and then retry the request there. This is all a manual process, and importantly, not something the client is likely to expect or account for, in the first place.
Typically, this is where API versioning would come in. You'd need to keep the old URLs active, and send out a deprecation notice to your clients, along with a date to upgrade by, which should be far enough out to allow your clients to reasonably update the their applications accordingly. Then, you can eventually turn off the old URLs once this date has passed. Clients that have not yet upgraded will still be broken, but you at least gave them fair warning first.
Upvotes: 2