Login: Password:
New account
Home »

WEB API for GamerCV

RESTful web API

Gamercv provides a RESTful web API to high scores. A RESTful web API (also called a RESTful web service) is a simple web service implemented using HTTP and the principles of REST.

Such a web service can be thought about as a collection of resources. On those resources you can use the 4 HTTP methods POST, GET, PUT and DELETE. Gamercv currently supports XML and JSON.

Read more about REST on Wikipedia.

For example, the resource to read and modify high scores is:

http://login:password@gamercv.com/games/1/high_scores

GET on that resource will return all high scores for the game with id 1.
POST to that resource will create a new high score. You can currently set 3 fields "name", "score" and "text".

More examples

To get high scores for game 1 in JSON-format: http://gamercv.com/games/1/high_scores.json

To get high scores for game 1 in XML-format: http://gamercv.com/games/1/high_scores.xml

Ruby

The quick easy way of get going is to check out class OnlineHighScoreList from Chingu. Also check out ruby example that's using OnlineHighScoreList. That example will fetch / add high scores to this page.

As you can see in the code the API login/password is "chingu" / "chingu", so feel free to test against it. Or just make an account and setup your own game with a login/password of your choice.

You could also interact with the resources in a more raw fashion using any number of libs. For ruby I like rest-client to work with resources.
With Crack you can decode XML and JSON responses into Ruby arrays.

You could also make it ultrasimple with open-uri and open():

Note, Ruby 1.9+ comes with built-in JSON support:

Create a high score using rest-client gem

C / C++ / C#

We don't actively use those languages ourselves but RESTful client libs should exist. Google is your friend.