Jump to content

Client-Server API

Posted on:February 8, 2013 at 01:00 AM

I will be shipping new iPhone game soon. It is 2 players, turn-based strategy game. Client-server architecture. More information soon ;) One question that came to my mind recently was: “How to handle app updates ?!“. Right now I use simple REST with http links like: /move, /setup, etc.... The potential problem will occur when a new version will require different JSON response from “/move” link. In that situation either version 1 or 2.0 will not work… or I’ll have to support both versions under the same link. This does not smell like a good solution. The image below shows the problem.

After some research and thinking I came up with such a solution:

For every new version, I will provide different API set. By doing that old client can still use the old API, since it is not changed. New clients use new API with new functions. One thing before shipping version 1.0 is to set up links correctly on the client side. Instead of /move it would be better to use some naming pattern, eg.: /api/v1/move.