Wiki
Clone wikiCasino2ApiClient / API
Contents:
- Common
- Obtaining SSL keys
- Actions description
- Player.set
- Player.get
- Balance.get
- Balance.change
- Balance.withdraw
- BankGroup.set
- BankGroup.massReset
- Game.list
- Game.run
- Session.get
- Session.list
- Session.close
- Spin.list
- Report.Game.get
- Report.Player.get
- Report.BankGroup.get
- Report.PlayerGame.get
- FSBonus.set
- FSBonus.list
- FSBonusPlayer.getBalance
- FSBonusPlayer.changeBalance
Common
To send API requests you will need:
- SSL private key (generated on client's server)
- SSL certificate (from casino's control panel)
- API URL (default is https://api.gamingmodule.com/)
*You may have different server address, just ask your manager about that.
All requests must be sent to API URL using POST method. Each request consists of JSON-encoded structure:
{ "action": "action id", "arguments": {} }
{ "success": true, "result": {} }
{ "success": false, "message": "Error description" }
Obtaining SSL keys
Generating private key and certificate signing request:
openssl req -out client.csr -new -newkey rsa:2048 -nodes -keyout client.key
casino123
where 123 is id of your casino.
Put contents of client.csr to API Cert dialog in your administrator's account and you will get signed API certificate.
Actions description
Player.set
This method sets player's data (such as unique id, nick, etc.).
Arguments:
Name | Description |
---|---|
player | Key-value dictionary holding player's data. Valid keys are: player_id, nick, bank_group. |
Description of player's attributes:
Key | Description |
---|---|
player_id | Unique player identifier in your system (i.e. login, email, phone, db primary key). It will be stored once on the first call. All next calls of this method with same player_id will perform update of existing record. |
nick | (optional) Player name for using in casino interface. Defaults to player_id |
bank_group | (optional) Player's bank group id. |
Example:
{ "action": "Player.set", "arguments": { "player": { "player_id": "p1", "nick": "Player 1", "bank_group": "agent995" } } }
Response:
Name | Description |
---|---|
player | Key-value dictionary holding player's data. It's format was descripted above. |
This method is idempotent.
When to call? When there is need to register player in casino or update player's info.
Player.get
Gets player's data
Arguments:
Name | Description |
---|---|
player | Unique player identifier in your system (i.e. login, email, phone, db primary key). |
Response:
Name | Description |
---|---|
player | Key-value dictionary holding player's data. It's format was descripted above. Null if player was not found. |
Balance.get
Retrieves actual balance of the player.
Arguments:
Name | Description |
---|---|
player | Unique player identifier in your system |
Response:
Name | Description |
---|---|
balance | Player's balance value |
Balance.change
Changes balance of the player.
Arguments:
Name | Description |
---|---|
player | Unique player identifier in your system |
amount | Positive amount for deposit, negative amount for withdrawal |
transaction_id (optional) | External transaction identifier |
Response:
Name | Description |
---|---|
balance_before | Player's balance before transaction |
balance_after | Player's balance after transaction |
transaction_id | Internal transaction id. Could be null in case of empty transaction. |
transaction_amount | Transaction amount |
When to call? Whenever there is need to change player's balance.
Balance.withdraw
Withdraws all the balance from player's account.
Arguments:
Name | Description |
---|---|
player | Unique player identifier in your system |
Response:
Name | Description |
---|---|
balance_before | Player's balance before transaction |
balance_after | Player's balance after transaction |
transaction_id | Internal transaction id. Could be null in case of empty transaction. |
transaction_amount | Transaction amount |
When to call? When there is need to take out all player's balance.
BankGroup.set
Creates/updates bank group info.
Arguments:
Name | Description |
---|---|
bank_group | Object with keys: id, name, default_value, jackpot_default_values, curency, template, jackpot_template. Where id is unique bank group identifier, name is human readable name and default_value is default value for newly created banks, jackpot_default_values is object with keys from slot1 to slot4 -- defaults for jackpot slots, currency is currency code for the bank group, template is optional preset of game settings for this bank group, jackpot_template is optional preset of jackpot settings. Note that setting template applied one time per method call. When template changes you should reapply template to bank group. |
Response:
Name | Description |
---|---|
bank_group | Object with keys: id, name, default_value, jackpot_default_values, currency. |
BankGroup.massReset
Reset banks to default values.
Arguments:
Name | Description |
---|---|
bank_groups | Array of bank group ids. |
Game.list
Retrieves list of casino games.
This method has no arguments.
Response:
Name | Description |
---|---|
games | Array of game records. Each record is in format {"id": "", "name": "", "close_button": false, "section": ""} , where id is a string game identifier, name is a human-readable game name, close_button is a boolean indication of availability of internal close button, section - game section id. |
Game.run
Creates game session.
Arguments:
Name | Description |
---|---|
game | Game string identifier |
player | (optional) Unique player identifier in your system. If not provided then session will be run in demo mode |
bank_group | (optional) Identifier of bank group of game session |
restore | (optional) If true then try to restore existing session with same parameters. If false then always create new clean session. If not provided then restore only recently opened player's session. |
demo | (optional) If true then session will be run in demo mode. Demo session will not affect any banks. |
demo_balance | (optional) Value of demo balance. |
static_host | (optional) Host for static files (useful for local cache) |
params | (optional) Params to override. Keys and values are strings. |
params_validation | (optional) Params validation mode: strict, soft (default) or silent. In strict mode any validation error will break the execution. In soft mode invalid parameters are ignored, except of denominations and bets. In silent mode all invalid parameters are ignored. |
fs_bonus | (optional) Bonus id |
Parameters object example:
#!json { "bets":"1,2,3,4,5,6,7,8,9,10", "currency":"EUR", "denominations":"0.01,0.02,0.05,0.1,0.2,0.5,1", "default_denomination":"0.05", "widescreen":"1", "language":"en", "help":"1" }
Response:
Name | Description |
---|---|
session_id | Unique session identifier. |
link | URL of game session |
Redirect player to session link.
Session.get
Gets session information by id.
Arguments:
Name | Description |
---|---|
session | Session id |
Response:
Name | Description |
---|---|
session | Object with session information |
Session object structure:
Key | Description |
---|---|
id | Session id |
start_time | Unix timestamp of session start |
end_time | Unix timestamp of session end |
player | Unique player id |
game | Unique game id |
bank_group | Unique bank group id |
start_balance | Player's balance on session start |
end_balance | Player's balance on session end |
bet_count | Bet count |
bet_sum | Bet sum |
win_sum | Winnings sum |
profit | Subtraction of bets and wins |
rtp | RTP % |
transaction_sum | Sum of transactions |
Session.list
List all sessions which were created during time range.
Arguments:
Name | Description |
---|---|
time_start | Starting unix timestamp |
time_end | Ending unix timestamp |
player | (optional) Player id |
bank_group | (optional) Bank group id |
state | (optional) Session state filter. Allowed values: 'open', 'closed', 'all'. Defaults to 'closed'. |
Response:
Name | Description |
---|---|
sessions | Array of objects with session information |
Session.close
Closes game session
Arguments:
Name | Description |
---|---|
session | Session id |
Response:
Name | Description |
---|---|
session | Object with session information |
Spin.list
List player spins
Arguments:
Name | Description |
---|---|
time_start | Starting unix timestamp |
time_end | Ending unix timestamp |
player | Player id |
Response:
Name | Description |
---|---|
spins | Array of objects with spin data |
Spin object structure:
Key | Description |
---|---|
id | Spin id |
time | Unix timestamp |
game | Game id |
bank_group | Bank group id |
session | Session id |
bet | Bet amount |
win | Win amount |
profit | Profit |
type | Spin type |
Report.Game.get
Game report Minimum time interval is 10 minutes.
Arguments:
Name | Description |
---|---|
time_start | Starting unix timestamp |
time_end | Ending unix timestamp |
bank_group | (optional) Bank group id |
Response:
Name | Description |
---|---|
report | Report array |
Report.Player.get
Player report Minimum time interval is 10 minutes.
Arguments:
Name | Description |
---|---|
time_start | Starting unix timestamp |
time_end | Ending unix timestamp |
bank_group | (optional) Bank group id |
Response:
Name | Description |
---|---|
report | Report array |
Report.BankGroup.get
Reports stats of players of specified BankGroup. Minimum time interval is 1 minute.
Arguments:
Name | Description |
---|---|
time_start | Starting unix timestamp |
time_end | Ending unix timestamp |
bank_group | (optional) Bank group id |
players | (optional) Player ids |
Response:
Name | Description |
---|---|
report | Report array |
Report.PlayerGame.get
Reports stats .
1 minute <= (time_end - time_start) <= 24 hours
Arguments:
Name | Description |
---|---|
time_start | Starting unix timestamp |
time_end | Ending unix timestamp |
time_resolution | (optional) Time resolution, one of: 1m, 10m, 1h, 3h, 6h |
Response:
Name | Description |
---|---|
report | Report array |
FSBonus.set
Upserts bonus.
Arguments:
Name | Description |
---|---|
bonus | Bonus object |
Bonus object:
Name | Description |
---|---|
id | Unique bonus identifier |
fs_type | Type of bonus. Currently only original bonus type supported |
counter_type | Type of bonus counters: shared (single counter for bonus) or separate (separate counter per game) |
shared_params | Params for shared bonus type. Example: |
separate_params | Params for separate bonus type. Example: {"games": {"secret_code": 10, "vikings_treasure": 15, "thrillspin": 5}} |
FSBonus.list
Lists created bonuses
Response:
Name | Description |
---|---|
fs_bonuses | Array of bonus objects |
FSBonusPlayer.getBalance
Returns total bonus balance for player
Name | Description |
---|---|
bonus_id | Bonus identifier |
player_id | Player identifier |
Response:
Name | Description |
---|---|
total_balance | total bonus balance for player |
FSBonusPlayer.changeBalance
Withdraws player's bonus balance or transfers it to player's main balance.
Name | Description |
---|---|
bonus_id | Bonus identifier |
player_id | Player identifier |
action | Action: withdraw or transfer_to_balance |
amount | Optional amount for transfer_to_balance action (if ommited then all amount will be tranfered) |
Updated