Can anyone point me towards examples of Browser Games / Browser Game Sites that use RESTful web services?

I have been convinced time and again that building web sites using RESTful principles is a good idea. And I agree. But I just can't wrap my head around what RESTful means when the service you're providing is just a single (or a few) games.

Any ideas or thoughts would be nice, but I'd also love to see some solid examples.

  • \$\begingroup\$ I don't understand what the question is. Maybe you should make an example what your web-service should do? A RESTful implementation for a game works exactly the same way as other RESTful services. \$\endgroup\$ – bummzack Apr 26 '12 at 6:42
  • 3
    \$\begingroup\$ I think he's ASKING for an example :-) \$\endgroup\$ – Wouter Lievens Apr 26 '12 at 15:35

I think the network protocol is really irrelevant, each game uses its own protocol, REST or any other standard is only important if you need to interoperate with third party software - which game servers mostly do not.

For example, if you published the API, using REST might be a good idea. But otherwise, I don't see any reason to do so.

  • \$\begingroup\$ I guess that is kind of my concern. While publishing an API for a game might add a level of uniqueness to the game, I'm not sure if it would always be desirable. Perhaps the RESTful portion might be to allow users to access different games on the site. But, I'm not seeing the real benefit for RESTful anything in my case, and I'm assuming that means I don't understand something well enough. \$\endgroup\$ – theJollySin Apr 26 '12 at 16:06
  • \$\begingroup\$ Publishing an API would be a bad idea, because if people started using it, you'd need to maintain backwards compatibility forever, which would certainly limit your ability to upgrade the game. \$\endgroup\$ – MarkR Apr 27 '12 at 11:42
  • \$\begingroup\$ Yeah, I've decided I'll create an API for things outside the game like getting character profiles and high scores and... things like that. But I can't see the benefit of exposing in-game functionality in a RESTful way. \$\endgroup\$ – theJollySin Apr 27 '12 at 15:37

You would have REST services for all the moves one could make, or for the game information requests.

Something like:

POST /game/45093/move?x=3&y=2

POST /game/45093/surrender

GET /game/45093/status

GET /games


  • \$\begingroup\$ Also remember about security unless you want me to surrender your game or move your player. \$\endgroup\$ – Kamil Apr 26 '12 at 11:30
  • \$\begingroup\$ @Kamil that's relatively easy. You will POST "surrender" which means "the player making this request surrenders". You would never add "self" as parameter, as that can be deduced from the session after login. Of course you still need to validate the rest of the application state... but that's the case for any web service. \$\endgroup\$ – Wouter Lievens Apr 26 '12 at 15:35
  • \$\begingroup\$ That's interesting Lievens. You would use the REST for in-game actions. My real question is, would YOU design a browser game this way? Is there a reason to design a game to have this kind of convenient API? My current bias is that you only create RESTful systems so users can access a online tools more easily. And I'm not sure if I see the benefit of RESTful whatever if the user isn't going to be using your website to... whatever, search the web or organize their bookmarks. \$\endgroup\$ – theJollySin Apr 26 '12 at 16:03
  • \$\begingroup\$ Now I am considering that perhaps the game itself wouldn't have to be that RESTful. But perhaps I could design other parts of the site that way. Like the user-stats, grabbing screenshots, sharing in-game items or skins between characters, or even just choosing your game. \$\endgroup\$ – theJollySin Apr 26 '12 at 17:11
  • \$\begingroup\$ I would design a browser game that way because I don't know any other way. What's your alternative? \$\endgroup\$ – Wouter Lievens Apr 27 '12 at 8:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.