Jump to content

Client-Server API

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

I will be shipping a new iPhone game soon. It is a 2-player, 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 a simple REST with http links like: /move, /setup, etc.... The potential problem will occur when a new version will require a 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 a different API set. By doing that, the old client can still use the old API, since it is not changed. New clients use a 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, e.g., /api/v1/move.