Skip to content
miq edited this page Sep 13, 2010 · 17 revisions

Here the REST API (a good discussion about REST) will be documented after it is a bit more stable and mature. All URLs to the API start with /api/.
Depending on the Accept-header either JSON (Accept not specified or application/json) or XML (Accept text/xml) can be served.

Resource player statistic summary:
Get statistical summary of all players:
URL: /api/stats/summary
Method: GET
Response: A list of general player statistics for all players. For more detailed stats other resources are neccessary.
Example-Requests:
wget --header=Accept:application/json http:https://localhost:8080/api/stats/summary
wget --header=Accept:text/xml http:https://localhost:8080/api/stats/summary

Resource sheet:
Create and update doppelkopf score sheets which will finally be used for the statistical calculations:
URL: /api/sheet
Method: POST
Params: JSON object containing group, location and the player ids
Response: A new empty and open sheet with the given parameters will be created. The URL of the new resource is returned in the Location header. A standings object is returned.
Example-Request: wget --save-headers --header="Content-Type:application/json" --post-data="{\"group\" : \"Infos\", \"location\" : \"Titanic\", \"playerIds\" : [ 1, 3, 4, 8]}" http:https://localhost:8080/api/sheet
Example-Response: {"standing":[0,0,0,0]}

Resource sheet:
Add deals to a sheet:
URL: /api/sheet/<sheet_id>/deal
Method: POST
Params: JSON object containing game type, score and player actions.
Possible values for gameType are normal, jackSolo, queenSolo, quietSolo, colorSolo.
Possible values for charly are cp for Charly Point, cl for Charly Lost, cc for Charly Caught and cpc for Charly Point and CharlyCaught.
Response: A standings object with the new score is returned.
Example-Request: wget --save-headers --header="Content-Type:application/json" --post-data="{\"gameType\" : \"normal\", \"score\" : 145, \"actions\" : [{ \"party\" : \"re\", \"bid\" : 0, \"foxesCaught\" : 0, \"foxesLost\" : 1, \"charly\" : \"\", \"doubleHeads\" : 0, \"hasSwines\" : false, \"hasMarriage\" : false, \"isPoor\" : true }, { \"party\" : \"contra\", \"bid\" : 0, \"foxesCaught\" : 0, \"foxesLost\" : 0, \"charly\" : \"\", \"doubleHeads\" : 0, \"hasSwines\" : false, \"hasMarriage\" : false, \"isPoor\" : true }, { \"party\" : \"re\", \"bid\" : 120, \"foxesCaught\" : 0, \"foxesLost\" : 0, \"charly\" : \"\", \"doubleHeads\" : 0, \"hasSwines\" : false, \"hasMarriage\" : false, \"isPoor\" : true }, { \"party\" : \"contra\", \"bid\" : 0, \"foxesCaught\" : 1, \"foxesLost\" : 0, \"charly\" : \"\", \"doubleHeads\" : 0, \"hasSwines\" : false, \"hasMarriage\" : false, \"isPoor\" : false } ]}" http:https://localhost:8080/api/sheet/1/deal
Example-Response: {"standing":[1,-1,1,-1]}

Clone this wiki locally