API for html5 games display on 3th - party site, version 1. 3


API for working with HTML5 games

Displaying our games on your website is easy. To do this, you must have at least 1 active terminal (login and password).
Integration steps are described below

STEP1 - Get a list of available Html5 games

To get a list of active games, use the command


HTTPS GET apiserver.solutions/remote_games_web


The API returns a json array of the following structure:

		<actualdate>2017-06-30 06:15:17</actualdate>
		<gamescount>120</gamescount>
		<gamelist>GAME_ARRAY</gamelist>


where gamescount is the number of available games, gamelist - contains an array of games divided into categories.
Each category (family) contains id (id), name of a category (name), and a sub-array of games (games)
 Each game in the games sub-array contains the id of the game (id), the name of the game (name), the web link to the icon (icon), and the dimensions in pixels (width and height)

STEP2 - Get User Session

To run the game on your site, in addition to its id, you also need to have an active user (terminal) session To get a session, use the User sessions management API , “set” command
Example of data to send:


<request>
<version>0.6</version>
<user_id>125</user_id>
<user_password>31003sdfds</user_password>
<operation>set</operation>
<show_packet>1</show_packet>
<response_url></response_url>
</request>


If the response is successful, you will get an array of data from terminal in which the parameters of the active session can be found:
sessionid – session id, key1, key2 - keys
Complete example of working with API sessions can be found in the corresponding section

STEP3- Display the game on your site

After the previous two steps, you have an active terminal session and a list of games.
To display the game by its number, use the command


HTTPS GET apiserver.solutions/showgame?gameid=GAMEID&sid=SID&key1=KEY1&key2=KEY2


where GAMEID – id of desired game, SID, KEY1, KEY2 - session parameters
In return you will receive a window with the game of the original size. You can put it in the popup window on your website or into the built-in frame, reducing dimensions proportionally if necessary. In addition, you can also pass the language parameter LANG, the available values ​​are English (en) and Russian (en)

Other game server API manuals

General API workflow

API requests are performed via https protocol by sending XML request using the "POST" method to the appropriate API URL

Step-by-step guide:

  1. You need to form an XML request signature. There are 3 types of signature possible:
    • type 1 - md5(hall_secret + XML_request (line) + hall_secret), where hall_secret is a hall secret word (see API for working with halls)
    • type 2 - base64_encode(agent_password), where agent_password is a password of the agent (API for working with agents)
    • type 3 - md5(user_password + XML_request (line) + user_password), where user_password - user (terminal) password (game logs API, sessions API)
  2. The XML request should have the following format: $xml = '<request>XML data</request>';
  3. Then you should encode the XML request using base64 encoding and send it to the specified URL using the POST method: field reg_xml => base64_encode(XML_request), field reg_sign => signature
  4. If the request is successful, you will receive a base64 format encoded XML packet and the packet signature. Response fields description is available in each API description. You can see the general response format below:
    <request>
    	<version>0.6</version>
    	<status>success</status>
    	<time>timestamp (unix_timestamp)</time>
    	...
    </request>
    		
  5. 5. In case of any failure, the response will contain 4 fields: version, status, time, code (will contain an error code). You can see general response format below:
    <request>
    	<version>0.6</version>
    	<status>failure</status>
    	<time>timestamp (unix_timestamp)</time>
    	...
    </request>
    		

In case of failure the field code in the packet will contain an error code:

Error code Description
request_not_exists Required fields (reg_xml, reg_sign) are not found in POST request
required_fields_are_empty Not all of required fields are present in the XML packet
invalid_xml_format Incorrectly formed XML document of the request
wrong_signature Wrong packet signature
wrong_api_version API version is specified incorrectly

Receiving a list of games

There are three different games lists available:

  1. https://apiserver.solutions/remote_games_list_new – returns at least 16 new games;
  2. https://apiserver.solutions/remote_games_list_pop – returns at least 16 popular games;
  3. https://apiserver.solutions/remote_games_list – returns all available games

The games lists can be received in three different formats: XML, JSON and JavaScript. Data in XML format are given automatically. To name an output format you should pass the parameter format with a setting xml, json or javascript in the request line.

The example of output for the request: https://apiserver.solutions/remote_games_list_new?format=json (JSON format):

{"gamelist":{"family":{"id":99,"name":"new","games":[{"id":245,"name":"flightsoffancy","icon":"http://content.stargame.solutions/api/game/icon/245","isaristocrat":1,"gametype":11,"url":"http://admin.stargamecasino.com/tote_opbetting3?gameid=245&x=329858436","width":1280,"height":1024},{"id":244,"name":"jaguarMist","icon":"http://content.stargame.solutions/api/game/icon/244","isaristocrat":1,"gametype":11,"url":"http://admin.stargamecasino.com/tote_opbetting3?gameid=244&x=1350294640","width":1400,"height":1024}]}}}

The example of output for the request: https://apiserver.solutions/remote_games_list_new?format=javascript (JavaScript format):

var casinoData = {"gamelist":{"family":{"id":99,"name":"new","games":[{"id":245,"name":"flightsoffancy","icon":"http://content.stargame.solutions/api/game/icon/245","isaristocrat":1,"gametype":11,"url":"http://admin.stargamecasino.com/tote_opbetting3?gameid=245&x=752267000","width":1280,"height":1024}]}}};

The example of output for the request: https://apiserver.solutions/remote_games_list (XML format):

<?xml version = "1.0" encoding = "utf-8" ?>
<root>
	<data>
		<actualdate>2014-12-12 06:15:17</actualdate>
		<gamescount>84</gamescount>
		<config>https://apiserver.solutions/flashconfig.php</config>
	</data>
	<gamelist>
		<family id="6" name="coolfire 2">
			<game>
				<id>211</id>
				<name>dragonemperor</name>
				<icon>https://apiserver.solutions/img/tote/games/cf_all/211.jpg</icon>
				<width>1024</width>
				<height>768</height>
				<url>https://apiserver.solutions/tote_opbetting3?gameid=211&x=353750879</url>
			</game>
			<game>
				<id>210</id>
				<name>diamonddestiny</name>
				<icon>https://apiserver.solutions/img/tote/games/cf_all/210.jpg</icon>
				<width>1024</width>
				<height>768</height>
				<url>https://apiserver.solutions/tote_opbetting3?gameid=210&x=804659655</url>
			</game>
			...
		</family>
		...
	</gamelist>
</root>

The list of new games and the list of popular games have similar structure but each block <game> (game description) has additional field isaristocrat (for more information see : The structure of available games list):

<game>
	<id>206</id>
	<name>50lions</name>
	<icon>https://apiserver.solutions/img/tote/games/cf_all/206.jpg</icon>
	<width>1024</width>
	<height>768</height>
	<url>https://apiserver.solutions/tote_opbetting3?gameid=206&x=2045331503</url>
</game>

Data for the lists of games are cached on the server. Cache is updated every 60 minutes.


The available games list structure

Structure of API response for receiving the list of games contains the following blocks and parameters:

data – general data:

  1. actualdate – creation date and time of game list on the side of the server
  2. gamescount – a number of games in this set
  3. config – a path to configuration for a flash loader

family – description of a category of games which this slot belongs to:

  1. id – category ID
  2. name – category name
  3. games – he list of games

game – parameters for each game:

  1. id – game ID
  2. name – game name
  3. icon – game icon link
  4. url – game link
  5. width – game window width
  6. height – game window height
  7. isaristocrat – if this parameter is equal 1, the game is referred to aristocrat (optional parameter)).

The list of new games contains only one category name="new" that has id=99. The list of the most popular games contains only one category name="popular" with id=77. The list of all games contains all available categories of games, except for id=99 and id=77, because these categories are collective ones (new and popular games).

User registration

User registration is performed through sending XML request to the address https://apiserver.solutions/api_reg

The required fields in XML request:

Field Type Required Description
version float Yes API version. It should be 0.6
hall_id integer Yes Hall ID
name string No User name. It should contain not less than 6 symbols. If it is not given, it is produced automatically.
phone bigint No Phone number. Numbers only, no spaces and no "+" sign.
email string No User email. If it is not given, it is produced automatically.
ex_id integer No User ID in client database
operation_id bigint No Operation ID in user system. Operation ID is used for packet resending. Only bigint ID type is acceptable. If ID type is not bigint, the operation is not logged and operation resending cannot be done!
password string No User password. It should contain not less than 6 symbols. If it is not given, it is produced automatically. The password can contain Latin characters and numbers only. If other symbols are present, they will be automatically cut by the system.
birthDay,
birthMonth,
birthYear
integer No User date of birth. This parameters should form a correct date. If the date is not correct, the system gives an operation error message. Example: birthDay=01, birthMonth=05, birthYear=1980
address string No User address
country string No User country
show_packet smallint Yes, if response_url is not given If the parameter is equal to 1, the result of the XML request will be given to the calling script. Otherwise, the result will be sent by url address passed in the parameter response_url
response_url string Yes, if the parameter show_packet is equal 0 The address whereon the result of the XML request is sent using the POST method, if the parameter show_packet is equal 0.

It is also necessary to produce a packet signature in the form of MD5 digest of the operation as follows: MD5(HALL_SECRET_WORD + XML request (line) + HALL_SECRET_WORD). md5 function is used for this operation in PHP.

After creating XML request structure it should be encoded using base64 (base64_encode function in PHP) and the line with the digital signature should be sent to the address https://apiserver.solutions/api_get_userslist метоup toм POST. The encrypted request line is put in the parameter reg_xml, the digital signature is put in the parameter reg_sign.

<?php
	//Creating digital sign
	$signature = md5($secret_word.$XML_REQUEST.$secret_word);

	//XML request encoding with base64_encode
	$base64_result = base64_encode($XML_REQUEST);

	//Creating array with data to be sent to server
	$post_request = array(
									'reg_xml' => $base64_result,
									'reg_sign' => $signature
								);

	//cURL initialization
	$ch = curl_init();

	//setting cURL options
	curl_setopt($ch, CURLOPT_URL, 'https://apiserver.solutions/api_reg');
	curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
	curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
	curl_setopt($ch, CURLOPT_POST, 1);

	//passing data
	curl_setopt($ch, CURLOPT_POSTFIELDS, $post_request);

	//enabling SSL
	curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 1);

	//fulfilling the request
	$result = curl_exec($ch);
?>

If the request is successful, you will receive a base64 encoded XML packet of response data and the packet signature. The response data packet contains the following fields:

Field Type Description
version float API version
status string Operation status. If it is successful - success; in case of failure - failure.
code string Error code
hall_id integer User hall ID
login string User login
password string User password
email string User email
phone bigint User phone number
time bigint Timestamp in unix timestamp format
birthDay,
birthMonth,
birthYear
integer User date of birth
operation_id bigint Operation ID in our system
country string User country
address string User address
operation_exist smallint The flag that shows whether the operation was executed for the first time , or this is repeated packet sending. The values 0 and 1 are acceptable.
is_first_deposit smallint The first deposit in the system or not. The values 0 and 1 are acceptable.
is_first_enter smallint The first enter. The values 0 and 1 are acceptable.

In case of failure the server request will contain 4 fields: version, status, hall_id + code field (it will contain an error code). The code field interpretation:

Error code Description
request_not_exists Required fields (reg_xml, req_sign) are not found in POST request
invalid_xml_sended Incorrectly formed XML document of the request
required_fields_are_empty Not all required fields in XML request are filled
wrong_signature Incorrect request signature
wrong_api_version API version is specified incorrectly
hall_not_exist The hall does not exist
hall_id_format_invalid Wrong hall_id field format
wrong_email Wrong email format
phone_format_invalid Wrong phone format
user_phone_already_exist This phone number is already registered in the system
wrong_password Wrong password
wrong_birthdate_params Wrong date of birth format (the parameters are birthDate, birthMonth, birthYear)

Outgoing XML request example:

<request>
	<version>0.6</version>
	<hall_id>125</hall_id>
	<phone>310903377415</phone>
	<birthDay>02</birthDay>
	<birthMonth>05</birthMonth>
	<birthYear>1980</birthYear>
	<address>some address</address>
	<password>sdgf55123</password>
	<show_packet>1</show_packet>
	<response_url></response_url>
</request>

Example of server response in case of valid request:

<request>
	<version>0.6</version>
	<login>95745</login>
	<password>sdf55yhh</password>
	<email>mRXqMXcrfD@stargamecasino.com</email>
	<phone>3808053344000</phone>
	<birthdate></birthdate>
	<hall_id>25</hall_id>
	<operation_id></operation_id>
	<operation_exist>0</operation_exist>
	<status>success</status>
	<time>1390778516</time>
	<ex_id></ex_id>
	<is_first_deposit>1</is_first_deposit>
	<is_first_enter>0</is_first_enter>
	<is_passing>0</is_passing>
</request>

Example of response in case of a failure:

<request>
	<version>0.6</version>
	<status>failure</status>
	<code>user_phone_already_exist</code>
	<hall_id>125</hall_id>
</request>

User sessions remote control

User sessions remote control is performed through sending an XML request to the address https://apiserver.solutions/remotecab_session using the POST method.

The required fields in the incoming XML request:

Field Type Required Description
version float Yes API version. It should be 0.6
user_id integer Yes User ID
user_password string Yes User password
operation string Yes Performed operation.
get - receiving user session
set - creating a new session
check - checking session status. If the session is closed, a new one is created.
close - closing all sessions
sessionid bigint Yes Session ID (required for the operation get)
key1 integer Yes Session key 1 (required for the operation get)
key2 integer Yes Session key 2 (required for the operation get)
show_packet smallint Yes, if response_url is not given If the parameter is equal to 1, the result of the XML request will be given to the calling script. Otherwise, the result will be sent by url address passed in the parameter response_url
response_url string Yes, if the parameter show_packet is equal 0 The address whereon the result of the XML request is sent using the POST method, if the parameter show_packet is equal 0.

Packet sign: type 3 (using user_password)

Request example:

<?php
	//Packet sign
	$signature = md5($secret_word.$XML_REQUEST.$secret_word);

	//Encoding XML-request with base64_encode
	$base64_result = base64_encode($XML_REQUEST);

	//Array of data to be sent to server
	$post_request = array(
									'reg_xml' => $base64_result,
									'reg_sign' => $signature
								);

	//cURL initialization
	$ch = curl_init();

	//Setting cURL options
	curl_setopt($ch, CURLOPT_URL, 'https://apiserver.solutions/remotecab_session');
	curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
	curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
	curl_setopt($ch, CURLOPT_POST, 1);

	//Data to be sent via CURl
	curl_setopt($ch, CURLOPT_POSTFIELDS, $post_request);

	//Enabling SSL
	curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 1);

	//Fulfilling the request
	$result = curl_exec($ch);
?>

If the request is successful, you will receive a base64 format encoded XML packet and the packet signature. The packet contains the following fields:

Field Type Description
version float API version
time bigint Timestamp in unix timestamp format
status string Operation status. If it is successful - success; in case of failure - failure.
code string Error code
uid integer Account ID
password string User password
sessionid bigint Session ID (for all operations, except for close)
key1 integer Session key (for all operations, except for close)
key2 integer Session key (for all operations, except for close)
name string User name (for the operations get and create only)
roomnumber integer Hall ID (for the operations get and create only)
email string User e-mail (for the operations get and create only)
phone bigint User phone number (for the operations get and create only)
birthdate timestamp User date of birth (for the operations get and create only)
balance bigint User balance (for the operations get and create only)
currency string Hall currency (for the operations get and create only)
unique_id string Unique user ID (for the operations get and create only)
is_first_deposit smallint The first deposit in the system or not (for the operations get and create only). The values 0 or 1 are accepted.
is_first_enter smallint The first enter (for the operations get and create only). The values 0 or 1 are accepted.
is_passing smallint Whether the user can incease his account using a remote website (for the operations get and create only)
is_home boolean Whether the hall has the homeedition status or not. The legacy parameter for backward compatibility with API legacy versions (for the operations get and create only)

In case of failure the server response will contain 4 fields: version, status, hall_id + code field (it will contain an error code). The code field interpretation:

Error code Description
request_not_exists Required fields (reg_xml, req_sign) are not found in POST request
wrong_api_version API version is specified incorrectly
invalid_xml_sended Incorrectly formed XML document of the request
required_fields_are_empty Not all required fields in XML request are filled
no_path_to_send_packet A path for a server response in not given
wrong_session_data Incorrect session data
wrong_user_data Incorrect password or user ID

Receiving user balance

Receiving user balance is performed through sending an XML request using the POST method to the address https://apiserver.solutions/api_get_balance

The required fields in the incoming XML request:

Field Type Required Description
version float Yes API version. It should be 0.6
user_id integer Yes User ID
hall_id integer Yes Game hall ID
user_ex smallint No If the value is equal 1, receive user data using ex_id (external user ID in client database). The value is equal 0 on default.
show_packet smallint Yes, if response_url is not given If the parameter is equal to 1, the result of the XML request will be given to the calling script. Otherwise, the result will be sent by url address passed in the parameter response_url
response_url string Yes, if the parameter show_packet is equal 0 The address whereon the result of the XML request is sent using the POST method, if the parameter show_packet is equal 0.

Packet sign: type 1 (using hall_secret)

Request example:

<?php
	//Packet sign
	$signature = md5($secret_word.$XML_REQUEST.$secret_word);

	//Encoding XML-request with base64_encode
	$base64_result = base64_encode($XML_REQUEST);

	//Array of data to be sent to server
	$post_request = array(
									'reg_xml' => $base64_result,
									'reg_sign' => $signature
								);

	//cURL initialization
	$ch = curl_init();

	//Setting cURL options
	curl_setopt($ch, CURLOPT_URL, 'https://apiserver.solutions/api_get_balance');
	curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
	curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
	curl_setopt($ch, CURLOPT_POST, 1);

	//Data to be sent via CURl
	curl_setopt($ch, CURLOPT_POSTFIELDS, $post_request);

	//Enabling SSL
	curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 1);

	//Fulfilling the request
	$result = curl_exec($ch);
?>

If the request is successful, you will receive a base64 format encoded XML packet and the packet signature. The packet contains the following fields:

Field Type Description
version float API version
status string Operation status. If it is successful - success; in case of failure - failure.
code string Error code (in case of failure only)
hall_id integer User hall ID
time bigint Timestamp in unix timestamp format
user_id integer User ID
balance bigint User balance in credits

In case of failure the field code in the packet will contain an error code:

Error code Description
request_not_exists Required fields (reg_xml) are not found in POST request
invalid_xml_format Incorrectly formed XML document of the request
required_fields_are_empty Not all required fields in XML request are filled
wrong_userid Wrong user_id
user_not_isset This user does not exist
wrong_signature Hall secret word is specified incorrectly
wrong_api_version API version is specified incorrectly
hall_not_exist The hall does not exist

Outgoing XML request example:

<request>
	<version>0.6</version>
	<hall_id>125</hall_id>
	<user_id>345</user_id>
	<show_packet>1</show_packet>
	<response_url></response_url>
</request>

Example of server response in case of valid request:

<request>
	<version>0.6</version>
	<status>success</status>
	<user_id>10025</user_id>
	<hall_id>129</hall_id>
	<balance>2924316</balance>
	<time>1390780004</time>
</request>

Example of response in case of a failure:

<request>
	<version>0.6</version>
	<status>failure</status>
	<code>hall_not_exist</code>
	<hall_id>125</hall_id>
</request>

User balance operations

User balance operations are performed through sending XML request to the address https://apiserver.solutions/api_operation_balance using the POST method

The required fields in the incoming XML request:

Field Type Required Description
version float Yes API version. It should be 0.6
user_id integer Yes User ID
hall_id integer Yes Game hall ID
user_ex smallint No If the value is 1, receive user data using ex_id (external user ID in client database). The value is 0 on default.
operation string Yes Performed operation type:
increase - balance increase,
decrease - balance writing off,
decrease_all - balance full resetting.
NOTE: you should note that after resetting all funds from the user account are withdrawn. However, the script checks the sum field. The value 0 should be sent to the sum field.
operation_id bigint No Operation ID in user system. Operation ID is used for packet resending. Only bigint ID type is acceptable. If ID type is not bigint, the operation is not logged and operation resending cannot be done!
sum integer Yes An amount of balance increase and an amount of balance writing off in corresponding operations ( in cents). This amount cannot exceed hall balance in balance increase and cannot exceed user balance in balance writing off.
user_password string No User password
show_packet smallint Yes, if response_url is not given If the parameter is equal to 1, the result of the XML request will be given to the calling script. Otherwise, the result will be sent by url address passed in the parameter response_url
response_url string Yes, if the parameter show_packet is equal 0 The address whereon the result of the XML request is sent using the POST method, if the parameter show_packet is equal 0.

Packet sign: type 1 (using hall_secret)

Request example:

<?php
	//Packet sign
	$signature = md5($secret_word.$XML_REQUEST.$secret_word);

	//Encoding XML-request with base64_encode
	$base64_result = base64_encode($XML_REQUEST);

	//Array of data to be sent to server
	$post_request = array(
									'reg_xml' => $base64_result,
									'reg_sign' => $signature
								);

	$ch = curl_init();

	//Setting cURL options
	curl_setopt($ch, CURLOPT_URL, 'https://apiserver.solutions/api_operation_balance');
	curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
	curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
	curl_setopt($ch, CURLOPT_POST, 1);

	//Data to be sent via CURl
	curl_setopt($ch, CURLOPT_POSTFIELDS, $post_request);

	//Enabling SSL
	curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 1);

	//Fulfilling the request
	$result = curl_exec($ch);
?>

If the request is successful, you will receive a base64 format encoded XML packet and the packet signature. The packet contains the following fields:

Field Type Description
version float API version
status string Operation status. If it is successful - success; in case of failure - failure.
code string Error code
hall_id integer User hall ID
user_id integer User ID
balance integer User balance in credits
time bigint Timestamp in unix timestamp format

In case of failure the server response will contain 4 fields: version, status, hall_id + code field (it will contain an error code). The code field interpretation:

Error code Description
request_not_exists Required fields (reg_xml, req_sign) are not found in POST request
invalid_xml_sended Incorrectly formed XML document of the request
required_fields_are_empty Not all required fields in XML request are filled
wrong_signature Incorrect request signature
wrong_api_version API version is specified incorrectly
wrong_userid Wrong user_id
user_not_isset This user does not exist
hall_not_exist The hall does not exist
operator_not_isset This operator does not exist in the hall
wrong_password Wrong password
too_low_balance_for_increase Too low balance increase value
too_low_hall_balance The hall balance is insufficient for this operation
previous_payments_not_finished Previous payment operations of the user are not finished
wrong_incoming_data Balance change inner error
operation_not_set operation field is not given

Outgoing XML request example:

<request>
	<version>0.6</version>
	<hall_id>125</hall_id>
	<user_id>345</user_id>
	<operation>increase</operation>
	<sum>500</sum>
	<show_packet>1</show_packet>
	<response_url></response_url>
</request>

Example of server response in case of valid request:

<request>
	<version>0.6</version>
	<status>success</status>
	<user_id>10125</user_id>
	<hall_id>125</hall_id>
	<operation>increase</operation>
	<operation_id></operation_id>
	<old_balance>5000</old_balance>
	<new_balance>5500</new_balance>
	<operation_exist>0</operation_exist>
	<time>1390783078</time>
</request>

Example of response in case of a failure:

<request>
	<version>0.6</version>
	<status>failure</status>
	<code>operation_not_set</code>
	<hall_id>125</hall_id>
</request>

Hall creation

This operation is performed through sending an XML request to the address https://apiserver.solutions/api_create_hall using the POST method.

The required fields in the incoming XML request:

Field Type Required Description
version float Yes API version. It should be 0.6
hall_name string Yes Hall name
hall_secret string Yes Hall secret word. It should contain only Latin characters and numbers in the amount of not more than 32.
agent_id integer Yes Agent ID
show_packet smallint Yes, if response_url is not given If the parameter is equal to 1, the result of the XML request will be given to the calling script. Otherwise, the result will be sent by url address passed in the parameter response_url
response_url string Yes, if the parameter show_packet is equal 0 The address whereon the result of XML request is sent using POST, if the parameter show_packet is equal 0.

Packet sign: type 2 (using agent password)

If the request is successful, you will receive a base64 format encoded XML packet and the packet signature. The packet contains the following fields:

Field Type Description
version float API version
status string Operation status. If it is successful - success; in case of failure - failure.
hall_id integer User hall ID
currency smallint ISO currency code

In case of failure the server response will contain 4 fields: version, status, hall_id + code field (it will contain an error code). The code field interpretation:

Error code Description
request_not_exists Required fields (reg_xml, req_sign) are not found in POST request
invalid_xml_sended Incorrectly formed XML request
required_fields_are_empty Not all required fields in XML request are filled
wrong_signature Incorrect request signature
wrong_api_version API version is specified incorrectly
agent_not_exist The agent does not exist
hall_name_already_exists This hall name is already used
hall_data_empty Hall name is not given

Outgoing XML request example:

<request>
	<version>0.6</version>
	<hall_name>MyNewHall</hall_name>
	<hall_secret>fgghhjjuku</hall_secret>
	<agent_id>12345678</agent_id>
	<response_url></response_url>
</request>

Example of server response in case of valid request:

<request>
	<version>0.6</version>
	<status>success</status>
	<time>123456789</time>
	<hall_id>114</hall_id>
	<hall_secret>somecode</hall_secret>
	<currency>643</currency>
</request>

Receiving a list of terminals of a hall

Receiving a list of terminals of a hall is performed using sending an XML request through POST to the address https://apiserver.solutions/api_get_userslist

The required fields in the incoming XML request:

Field Type Required Description
version float Yes API version. It should be 0.6
hall_id integer Yes Game hall ID
show_packet smallint Yes, if response_url is not given If the parameter is equal to 1, the result of the XML request will be given to the calling script. Otherwise, the result will be sent by url address passed in the parameter response_url
response_url string Yes, if the parameter show_packet is equal 0 The address whereon the result of the XML request is sent using the POST method, if the parameter show_packet is equal 0.

Request example:

<?php
	//Encoding XML-request with base64_encode
	$base64_result = base64_encode($XML_REQUEST);

	//Array of data to be sent to server
	$post_request = array('reg_xml' => $base64_result);

	//cURL initialization
	$ch = curl_init();

	//Setting cURL options
	curl_setopt($ch, CURLOPT_URL, 'https://apiserver.solutions/api_get_userslist');
	curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
	curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
	curl_setopt($ch, CURLOPT_POST, 1);

	//Data to be sent via CURl
	curl_setopt($ch, CURLOPT_POSTFIELDS, $post_request);

	//Enabling SSL
	curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 1);

	//Fulfilling the request
	$result = curl_exec($ch);
?>

If the request is successful, you will receive a base64 format encoded XML packet and the packet signature. The packet contains the following fields:

Field Type Description
version float API version
status string Operation status. If it is successful - success; in case of failure - failure.
code string Error code
hall_id integer User hall ID
time bigint Timestamp in unix timestamp format
users_count integer Number of users
users array Array with detailed information about users

In case of failure the field code in the packet will contain an error code:

Error code Description
request_not_exists Required fields (reg_xml) are not found in POST request
invalid_xml_format Incorrectly formed XML document of the request
required_fields_are_empty Not all required fields in XML request are filled
wrong_signature Incorrect request signature
wrong_api_version API version is specified incorrectly
hall_not_exist The hall does not exist

Outgoing XML request example:

<request>
	<version>0.6</version>
	<hall_id>125</hall_id>
	<show_packet>1</show_packet>
	<response_url></response_url>
</request>

Example of server response in case of valid request:

<request>
	<version>0.6</version>
	<status>success</status>
	<hall_id>125</hall_id>
	<time>1390568302</time>
	<users_count>2</users_count>
	<users>
		<user><uid>30359</uid>
			<name>protest1</name>
			<password>fxa445</password>
			<balance>347</balance>
		</user>
		<user><uid>308905</uid>
			<name>protest2</name>
			<password>4454599</password>
			<balance>4004</balance>
		</user>
	</users>
</request>

Example of response in case of a failure:

<request>
	<version>0.6</version>
	<status>failure</status>
	<code>wrong_signature</code>
	<hall_id>250</hall_id>
</request>

Hall configuration change

This operation is performed through sending an XML request to the address https://apiserver.solutions/api_hall_settings using the POST method

The required fields in the incoming XML request:

Field Type Required Description
version float Yes API version. It should be 0.6
hall_id integer Yes Hall ID
operation string Yes Operation: get - receiving current settings array, set - settings update
settings array Yes Settings array. It is required for the operation set only
show_packet smallint Yes, if response_url is not given If the parameter is equal to 1, the result of the XML request will be given to the calling script. Otherwise, the result will be sent by url address passed in the parameter response_url
response_url string Yes, if the parameter show_packet is equal 0 The address whereon the result of XML request is sent using POST, if the parameter show_packet is equal 0.

Packet sign: type 1 (using hall_secret)

The description of the parameter settings for the operation set:

Parameter name Type Description Acceptable values
maxbetperline Maximum bet per line integer 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 15, 20, 25, 30,40, 50, 100
maxwin Maximum win on reels integer Evaluation by formula: not less than maxbetperline * 500
maxriskwin Maximum win in risk game integer Evaluation by formula: not less than maxbetperline * 500
creditlimit Credits limit integer From 100 to 1000000
matproc Mathematical efficiency percentage integer 80, 83, 85, 88, 93
maxriskround Maximum amount of rounds in risk game integer От 2 up to 100
denominationenable Whether denomination is abled boolean 1 or 0
denominationminval Denomination MIN float 0.01, 0.02, 0.04, 0.05, 0.1, 0.25, 0.5, 0.75,1.00
denominationmaxval Denomination MAX float 0.25, 1.00, 2.00, 4.00, 5.00, 10.00, 25.00, 50.00, 100.00
minamount Minimum amount for payment integer It cannot be less or equal 0
pbonus Percentage of deposit to bonus integer From 0 to 15
mbonus Minimum deposit for bonus integer It cannot be less or equal 0
fixedcashback Fixed cashback bonus integer 1 (enabled) or 0 (disabled) . If cashback bonus or fixed cashback bonus enabled, deposit bonus will be set to 0

It should be noted that individual settings can be changed, ie there is no need to enumerate all the settings to change one of them. In this case, simply select the desired settings in the packet setting without specifying the rest of settings. The get operation returns all settings.

If the request is successful, you will receive a base64 format encoded XML packet and the packet signature. The packet contains the following fields:

Field Type Description
version float API version
status string Operation status. If it is successful - success; in case of failure - failure.
hall_id integer Hall ID
operation string Operation: get or set
time bigint Timestamp in unix timestamp format
settings array Current hall settings list. For the operation get only.

In case of failure the field code in the packet will contain an error code:

Error code Description
request_not_exists Required fields (reg_xml) are not found in POST request
invalid_xml_format Incorrectly formed XML document of the request
required_fields_are_empty Not all required fields in XML request are filled
wrong_signature Incorrect request signature
wrong_api_version API version is specified incorrectly
hall_not_exist The hall does not exist
too_low_maxwin maxwin < winMinLimit or maxwin < 100
too_big_maxwin maxwin > 1000000
too_low_maxriskwin maxriskwin < winMinLimit or maxriskwin < 100
too_big_maxriskwin maxriskwin > 1000000
wrong_creditlimit_count creditlimit < 100 or creditlimit > 1000000
wrong_maxriskround_count maxriskround < 2 or maxriskround > 100
wrong_denominationmin_count The value denominationminval is not in the range (1, 2, 4, 5, 10, 25, 50, 75, 100)
wrong_denominationmax_count The value denominationmaxval is not in the range (25, 100, 200, 400, 500, 1000, 2500, 5000, 10000)
denmin_biggest_than_denmax denominationmaxval < denominationminval
wrong_pbonus_count pbonus < 0 or pbonus > 15
wrong_mbonus_count mbonus < 0
nothing_to_update Settings array is empty (no data for update)

Hall messages operations

This operation is performed through sending an XML request to the address https://apiserver.solutions/api_hall_message using the POST method.

The required fields in the incoming XML request:

Field Type Required Description
version float Yes API version. It should be 0.6
hall_id integer Yes Hall ID
operation string Yes Operation: add - adding message, delete - deleting message
text string Yes (operation add) Message text. The maximum amount is 255 characters. Latin and cyrillic characters and numbers.
repeat integer Yes (operation add) Message repetitions amount. Accaptable values: from 1 to 100.
send_type string Yes (operation add) Output type. Acceptable values: time_repeat - one time with repetitions, regular - regular (see comments below the table).
schedule array Yes (operation add) Serialized base64 array, formats for operations differ (see comments below the table).
message_id integer Yes (operation delete) ID of the message to be deleted
show_packet smallint Yes (if response_url is not given) If the parameter is equal to 1, the result of the XML request will be given to the calling script. Otherwise, the result will be sent by url address passed in the parameter response_url
response_url string Yes (if show_packet is not given) The address whereon the result of XML request is sent using POST, if the parameter show_packet is equal 0.

schedule array forming example:

<?php

$shedule = base64_encode(serialize(array('dateFrom' => '2011-12-11', 'hours' => '11', 'minutes' => '20', 'interval' => 30)));

?>

send_type massive array forming for one_time_repeat type example:

<?php

$send_type = array('dateFrom' => '2015-01-02', 'hours' => 12, 'minutes' => 20, 'interval' => 30);

?>

Acceptable values for this array parameters: dateFrom - date as year-month-day, hours - from 0 to 24, minutes - from 0 to 59, interval - sending interval in minutes, acceptable values: 10, 30, 60, 120, 180, 360, 1140, 2880. send_type array forming for regular type example:

<?php

$send_type = array('dateFrom' => '2015-01-02', 'dateTo' => '2015-02-02', 'interval' => 60);

?>

Packet sign: type 1 (using hall_secret)

If the request is successful, you will receive a base64 format encoded XML packet and the packet signature. The packet contains the following fields:

Field Type Description
version float API version
time bigint Timestamp in unix timestamp format
status string Operation status. If it is successful - success; in case of failure - failure.
code string Error code
message_id integer Added or Deleted message ID for the operations add and delete respectively
hall_id integer Hall ID

In case of failure the field code in the packet will contain an error code:

Error code Description
request_not_exists Required fields (reg_xml) are not found in POST request
invalid_xml_format Incorrectly formed XML document of the request
required_fields_are_empty Not all required fields in XML request are filled
wrong_signature Incorrect request signature
wrong_api_version API version is specified incorrectly
hall_not_exist The hall does not exist
message_not_isset A message with this ID does not exist
message_fields_are_empty Parameters for adding the message are not given or not all of them are given
text_too_big The amount of characters exceeds 255
unable_to_parse_schedule Messages sending schedule cannot be parsed. The parameter is empty, is not serialized or is not encoded base64.
wrong_schedule_format Incorrect messages sending schedule format ( the parameters are dateFrom,dateTo, hours, minutes, interval)
unknown_operation Incorrectly given operation

Receiving hall balance

The operation is performed through sending an XML request to the address https://apiserver.solutions/api_get_hall_balance using the POST method

The required fields in the incoming XML request:

Field Type Required Description
version float Yes API version. It should be 0.6
hall_id integer Yes Hall ID
show_packet smallint Yes, if response_url is not given If the parameter is equal to 1, the result of the XML request will be given to the calling script. Otherwise, the result will be sent by url address passed in the parameter response_url
response_url string Yes, if the parameter show_packet is equal 0 The address whereon the result of the XML request is sent using the POST method, if the parameter show_packet is equal 0.

Packet sign: type 1 (using hall_secret)

If the request is successful, you will receive a base64 format encoded XML packet and the packet signature. The packet contains the following fields:

Field Type Description
version float API version
status string Operation status. If it is successful - success; in case of failure - failure.
code string Error code
hall_id integer User hall ID
balance integer Hall balance
time bigint Timestamp in unix timestamp format

Receiving agent balance

This operation is performed through sending an XML request to the address https://apiserver.solutions/api_get_agent_balance using the POST method

The required fields in the incoming XML request:

Field Type Required Description
version float Yes API version. It should be 0.6
agent_id integer Yes Agent ID
show_packet smallint Yes, if response_url is not given If the parameter is equal to 1, the result of the XML request will be given to the calling script. Otherwise, the result will be sent by url address passed in the parameter response_url
response_url string Yes, if the parameter show_packet is equal 0 The address whereon the result of the XML request is sent using the POST method, if the parameter show_packet is equal 0.

Packet sign: type 2 (using agent password)

If the request is successful, you will receive a base64 format encoded XML packet and the packet signature. The packet contains the following fields:

Field Type Description
version float API version
status string Operation status. If it is successful - success; in case of failure - failure.
code string Error code
agent_id integer Agent ID
balance integer Agent balance in money coins (for example, us cents)
time bigint Timestamp in unix timestamp format

In case of failure the field code in the packet will contain an error code:

Error code Description
request_not_exists Required fields (reg_xml) are not found in POST request
invalid_xml_format Incorrectly formed XML document of the request
required_fields_are_empty Not all required fields in XML request are filled
wrong_signature Incorrect request signature
wrong_api_version API version is specified incorrectly
agent_not_exist An agent having this ID and this password does not exist
invalid_agent_id Incorrect agent ID format or the parameter is not given

Hall Jackpot operations

The operation is performed through sending an XML request to the address https://apiserver.solutions/api_operation_jackpot using the POST method

The required fields in the incoming XML request:

Field Type Required Description
version float Yes API version. It should be 0.6
hall_id integer Yes Hall ID
operation string Yes Operation type: get_balance - getting balance (NOTE: current value is given in money coins), reset - Jackpot reset, change - Jackpot value change, get_settings - getting settings array, set_settings - new settings customizing, get_history - get jackpots history
settings array Yes Settings array (for the operation set_settings only)
period_start unix timestamp Yes Selection period start. The format is unix timestamp format . For the operation get_history only
period_end unix timestamp Yes Selection period end. The format is unix timestamp format. For the operation get_history only
show_packet smallint Yes, if response_url is not given If the parameter is equal to 1, the result of the XML request will be given to the calling script. Otherwise, the result will be sent by url address passed in the parameter response_url
response_url string Yes, if the parameter show_packet is equal 0 The address whereon the result of the XML request is sent using the POST method, if the parameter show_packet is equal 0.

Packet sign: type 1 (using hall_secret)

The description of the settings parameter for the operation set_settings:

Parameter name Type Description Acceptable values
enable Whether Jackpot is enabled smallint 0 or 1
jackpotpercent Percents from each bet to Jackpot float 0, 0.25, 0.5, 0.75, 1, 1.25, 1.5, 1.75, 2
timer Jackpot timer integer From 0 to 86399. Time in seconds. Let assume, you need to set the timer to 10:30:15 AM The final parameter value should be 10*60*60+30*60+15
tunejackpot Apply basevalue to jackpots smallint 0,1. If parameter set to 1, jackpot values will be equal to jackpot "basevalue" parameters. The corresponding amount will be taken off from the hall balance. This operation cannot be canceled. The amount that will be taken off from the hall balance is equal to the sum of the differences between the current jackpot values ​​and their basevalues.
interval_enabled Activate jackpot hit period smaillint 0,1
interval_start Start time integer From 0 to 1440. Time in minutes. For example, if start time should be 10:30 AM, set parameter to 10*60+30
interval_end End time integer From 0 to 1440. Time in minutes. For example, if start time should be 12:30 AM, set parameter to 12*60+30. The difference between end time and start time should be more than 1 minute
bronze,silver,gold,diamond 4 arrays for each jackpot level settings array bronze - first level (bronze jackpot), and so on in ascending order
outtext Text of the message that is displayed on a game terminal. string Only Latin characters, dots,commas and exclamation marks are acceptable.

Описание массива каждого уровня джекпота

Parameter name Type Description Acceptable values
enable Enabled or not smallint 0 or 1
activate Activation value integer From 0 to 2500000. After reaching this value the jackpot changes from passive state to active. In passive state the jackpot cannot be won. When jackpot is in active state, every player whose bet satisfies the terms of jackpot drawing has chances to win
init Base value integer From 0 to 2500000. Jackpot base value, the default is 0. If the value is set, after every jackpot draw, the upcoming jackpot value will start from this amount. ATTENTION!!! Jackpot base value is being taken off from the hall balance
max Max value integer From 0 to 2500000. If max value is 0, it is ignored and jackpot is drawn by Timer. If max value is larger than Activation value, jackpot is drawn by Max value. The closer approximation to that value, the higher jackpot draw probability.
minbet Minimum bet integer From 0 to 2500 000 00 The minimum bet for the player to participate in jackpot. When playing for smaller bets, the Player cannot win the jackpot. ATTENTION!!! Indicated in cents. If you want to set min bet to 1 dollar, you should send 100 value

If the request is successful, you will receive a base64 format encoded XML packet and the packet signature. The packet contains the following fields:

Field Type Description
version float API version
status string Operation status. If it is successful - success; in case of failure - failure.
hall_id integer Hall ID
operation string Error code: get_balance, reset, change, get_settings or set_settings
jackpotvalue bigint Current Jackpot in money coins centesimals
time bigint Timestamp in unix timestamp format
settings array Jackpot settings list
history array Jackpot history array

In case of failure the field code in the packet will contain an error code:

Error code Description
request_not_exists Required fields (reg_xml) are not found in POST request
invalid_xml_format Incorrectly formed XML document of the request
required_fields_are_empty Not all required fields in XML request are filled
wrong_signature Incorrect request signature
wrong_api_version API version is specified incorrectly
hall_not_exist The hall does not exist
wrong_settings_array Incorrect settings array (operation set_settings)
wrong_jackpot_percent Incorrect Jackpot percentage (operation set_settings)
wrong_activate_value Incorrect activate value (operation set_settings)
wrong_init_value Wrong base value (operation set_settings)
activation_LEVEL_value_not_set The activation value of corresponding LEVEL(bronze,silver,gold,diamond) is not set (операция set_settings)
init_value_should_not_be_more_than_half_of_activation_value Jackpot base value is more than half the activation value (operation set_settings)
next_level_jackpot_should_double_previous Each next jackpot level should be minimum twice as large as the previous one. The error will also occur if you include levels not sequentially. If you want to enable some level, the previous one must be included too (operation set_settings)
jackpot_interval_wrong Wrong jackpot hit period interval (operation set_settings)
timer_wrong Wrong jackpot timer value (operation set_settings)
nothing_to_update No data for update (operation set_settings)
time_periods_are_empty The error is given if operation = get_history, if the field period_start, or period_end is empty
invalid_date_format Incorrect date format in the fields period_start, or period_end.
time_period_more_that_thirty_days Selection period exceeds thirty days.
Full request example to set 4 levels jackpot:
 <request>
    <version>0.6</version>
    <settings>
       <enable>1</enable>
       <outtext>STAR JACKPOT</outtext>
       <timer>1800</timer>
       <jackpotpercent>2</jackpotpercent>
       <tunejackpot>1</tunejackpot>
       <interval_enabled>1</interval_enabled>
       <interval_start>100</interval_start>
       <interval_end>400</interval_end>
       <bronze>
          <enable>1</enable>
          <minbet>300</minbet>
          <init>30</init>
          <max>3000</max>
          <activate>300</activate>
       </bronze>
       <silver>
          <enable>1</enable>
          <minbet>300</minbet>
          <init>60</init>
          <max>3000</max>
          <activate>600</activate>
       </silver>
       <gold>
          <enable>1</enable>
          <minbet>300</minbet>
          <init>90</init>
          <max>3000</max>
          <activate>1200</activate>
       </gold>
       <diamond>
          <enable>1</enable>
          <minbet>900</minbet>
          <init>90</init>
          <max>9000</max>
          <activate>2400</activate>
       </diamond>
    </settings>
    <operation>set_settings</operation>
    <user_id>77777</user_id>
    <hall_id>77</hall_id>
    <show_packet>1</show_packet>
 </request>

This request matches the following settings in the admin panel



Receiving agent halls list

The operation is performed through sending an XML request to the address https://apiserver.solutions/api_get_hallslist using the POST method

The required fields in the incoming XML request:

Field Type Required Description
version float Yes API version. It should be 0.6
agent_id integer Yes Agent ID
show_packet smallint Yes, if response_url is not given If the parameter is equal to 1, the result of the XML request will be given to the calling script. Otherwise, the result will be sent by url address passed in the parameter response_url
response_url string Yes, if the parameter show_packet is equal 0 The address whereon the result of the XML request is sent using the POST method, if the parameter show_packet is equal 0.

Packet sign: type 2 (using agent password)

If the request is successful, you will receive a base64 format encoded XML packet and the packet signature. The packet contains the following fields:

Field Type Description
version float API version
status string Operation status. If it is successful - success; in case of failure - failure.
code string Error code
agent_id integer Agent ID
halls_count integer Number of halls
halls array Halls array
time bigint Timestamp in unix timestamp format

Present halls are received as an array. The array example:

<?php
'hall' => (
		'id' => 1,
		'name' =>
		'hall1',
		'balance' => 10400,
		'operator_name' => 'oper1'
	);
?>

where id - hall ID, name - hall name, balance – hall balance, operator_name – operator name.

In case of failure the field code in the packet will contain an error code:

Error code Description
request_not_exists Required fields (reg_xml) are not found in POST request
invalid_xml_format Incorrectly formed XML document of the request
required_fields_are_empty Not all required fields in XML request are filled
wrong_signature Incorrect request signature
wrong_api_version API version is specified incorrectly
agent_not_exist An agent having this ID and this password does not exist
invalid_agent_id Incorrect user ID format or the parameter is not given

Hall balance changing by an agent

The operation is performed through sending an XML request to the address https://apiserver.solutions/api_hall_operation_balance using the POST method

The required fields in the incoming XML request:

Field Type Required Description
version float Yes API version. It should be 0.6
agent_id integer Yes Agent ID
hall_id integer Yes Hall ID
operation string Yes Operation type: increase - balance increase, descrese - balance write off
sum integer Yes Sum
show_packet smallint Yes, if response_url is not given If the parameter is equal to 1, the result of the XML request will be given to the calling script. Otherwise, the result will be sent by url address passed in the parameter response_url
response_url string Yes, if the parameter show_packet is equal 0 The address whereon the result of the XML request is sent using the POST method, if the parameter show_packet is equal 0.

Packet sign: type 2 (using agent password)

If the request is successful, you will receive a base64 format encoded XML packet and the packet signature. The packet contains the following fields:

Field Type Description
version float API version
status string Operation status. If it is successful - success; in case of failure - failure.
hall_id integer Hall ID
code string Error code
old_balance integer Former hall balance in money coins
new_balance integer New hall balance in money coins
time bigint Timestamp in unix timestamp format

In case of failure the field code in the packet will contain an error code:

Error code Description
request_not_exists Required fields (reg_xml) are not found in POST request
invalid_xml_format Incorrectly formed XML document of the request
required_fields_are_empty Not all required fields in XML request are filled
wrong_signature Incorrect request signature
wrong_api_version API version is specified incorrectly
agent_not_exist An agent having this ID and this password does not exist
agent_is_not_owner This agent is not the hall owner
wrong_operation Incorrect operation
hall_too_low_balance Insufficient hall balance (operation decrease)
agent_too_low_balance Insufficient agent balance (operation increase)

Receiving user operations list

The operation is performed through sending an XML request to the address https://apiserver.solutions/api_get_agent_story using the POST method.

The required fields in the incoming XML request:

Field Type Required Description
version float Yes API version. It should be 0.6
agent_id integer Yes Agent ID
period_start bigint Yes Unix timestamp, request period start
period_end bigint Yes Unix timestamp, request period end
show_packet smallint Yes, if response_url is not given If the parameter is equal to 1, the result of the XML request will be given to the calling script. Otherwise, the result will be sent by url address passed in the parameter response_url
response_url string Yes, if the parameter show_packet is equal 0 The address whereon the result of the XML request is sent using the POST method, if the parameter show_packet is equal 0.

Note: difference between the start and the end of the period cannot exceed three days.

Packet sign: type 2 (using agent password)

If the request is successful, you will receive a base64 format encoded XML packet and the packet signature. The packet contains the following fields:

Field Type Description
version float API version
status string Operation status. If it is successful - success; in case of failure - failure.
agent_id integer Agent ID
code string Error code
period_start bigint Unix timestamp, request period starts
period_end bigint Unix timestamp, request period end
operations_count integer A number of operations
operations array Operations array
time bigint Timestamp in unix timestamp format

Operations history is received as an array. This array example:

<?php
'operation' => array('id' => 1,
                     'description' => 'hall 360, + 1000',
                     'date' => time(),
                     'balance_before' => 104000,
                     'sum' => 100000
                     'balance_after' => 40000,
                     'by' => 'someagent');
?>

In case of failure the field code in the packet will contain an error code:

Error code Description
request_not_exists Required fields (reg_xml) are not found in POST request
invalid_xml_format Incorrectly formed XML document of the request
required_fields_are_empty Not all required fields in XML request are filled
wrong_signature Incorrect request signature
wrong_api_version API version is specified incorrectly
agent_not_exist An agent having this ID and this password does not exist
wrong_period_data Incorrectly given request period
too_big_period Too big period is given

Receiving a list of game logs

The operation is performed by sending an XML-request using the POST method to https://apiserver.solutions/remotecab_game_history

Required fields in the XML-request:

Field Type Required Description
version float Yes API version. It should be 0.4 or 0.5
user_id integer Yes User ID
user_password string Yes User password
use_hash integer Yes If this parameter is equal 1, the field user_password should not contain a password. It should contain md5digest. If it is equal 0, plain password is used.
operation string Yes Operation type . List - get logs list for the period. Log - get details for 1 log
log_id / game_id bigint /int Yes Game log ID or game ID (either) for log operation . If game_id is specified, the latest game log will be returned
period_start datetime Yes Selection period start. The format is YEAR-MONTH-DAY HOUR:MINUTE:SECOND. For the operation list only
period_end datetime Yes Selection period end. The format YEAR-MONTH-DAY HOUR:MINUTE:SECOND. For the operation list only
show_packet smallint Yes, if response_url> is not specified If the parameter is equal 1, the result of the XML request will be given to the calling script. Otherwise, the result will be sent to the address passed in the parameter response_url
response_url string If the parameter show_packet is equal 0 The address whereon the result of the XML-request is sent, if the parameter show_packet is equal 0. Sending is performed using the POST method.

Note: difference between the start and the end of the period cannot exceed six days.

Also a digital signature should be formed as md5(user_password + XML_request (string) + user_password), user_password is user password

Noted restrictions: The maximum interval of logs selection is 24 hours. The maximum period of selection is 7 days. Logs are stored on our server for not more than 7 days. We recommend you to select logs every hour and put them into your database. It will reduce load on the server and increase speed of your system operating. Analyzing game log information we separately give a formed html-code (base64 encoded) as information analysis is performed on our side. Pictures from a log have links to our server.

If the request is successful, you will received a base64 format encoded XML packet and the packet signature. The packet will contain the following fields:

1. For the operation list – receiving a list of logs:
Field Type Description
version float API version
status string Operation status. If it is successful - success; in case of failure - failure.
user_id integer User ID
user_hash integer Determines the way a packet signature is made - md5(user_password), or user_password. See the parameter use_hash as above.
code string Error code
hall_id integer User hall number
logs_count integer Number of records
operation bigint Selected operation
timestamp bigint Timestamp in UNIX timestamp format
md5 string Packet signature

Game log array content

Field Type Description
dataid bigint Game log ID
gameid integer Game index
date datetime Game day and time, the format is YEAR-MONTH-DAY HOUR:MINUTE:SECOND
bet bigint Field BET (bet)
win bigint Field WIN (win)
lines bigint Field LINES
balance bigint User balance
gname string Game name

For the operation log – receiving information on a selected log

Field Type Description
status string Operation status. If it is successful – success; failure – in case of failure.
code string Error code. The field does not exist if the status is success
user_id integer User ID
use_hash integer Determines the way a packet signature is made — md5(user_password), or user_password. See the parameter use_hash as above.
hallid integer User hall number
timestamp bigint Timestamp in unix timestamp format
operation string Selected operation
log_id bigint Game log ID
log_date datetime Log day and time. The format is YEAR-MONTH-DAY HOUR:MINUTE:SECOND
log_bet bigint Field BET (bet)
log_win bigint Field WIN (win)
log_betline bigint Field BetLine
log_lines bigint Field LINES
log_balance bigint User balance
log_gname string stringGame name
log_html string HTML with log interpretation and game pictures. The string is base64 encoded.
md5 string Packet signature. It is formed as md5Encrypt (user_password + timestamp + user_id + user_password)

In case of failure the field code the the packet will contain an error code:

Error code Description
request_not_exists Required fields (reg_xml) are not found in POST request
invalid_xml_sended Incorrectly formed XML document
wrong_api_version Incorrect API version ( 0.5 are 0.4 supported)
required_fields_are_empty Not all required fields in the XML-request are filled
no_path_to_send_packet The parameter show_packet is equal 0, response_url is not specified
wrong_userid User ID is specified incorrectly
user_not_isset A user having this ID does not exist
wrong_user_pass User password is specified incorrectly.
time_periods_are_empty The error is given if operation = list, if the field period_start, or period_end is empty
invalid_date_format Incorrect date format in the fields period_start, or period_end.
time_period_more_that_one_day Selection period exceeds 24 hours. (60*60*24)
game_id_is_wrong, log_id_is_wrong The error is given if operation = log, if the format of the field log_id or game_id is incorrect
either_game_id_or_log_id_must_be_supplied The error is given if operation = log, if the fields log_id and game_id are empty (at least 1 parameter should be given)
invalid_operation_name The field operation is filled incorrectly. list and log are accepted.
log_is_not_isset The log having specified ID and belonging to the user having specified ID is not found.
An example of request and response :
Request
 <request>
 <version>0.4</version> 
 <operation>log</operation> 
 <user_id>12044</user_id> 
 <user_password>1DF12b3</user_password> 
 <use_hash>0</use_hash> 
 <log_id>5951155076</log_id> 
 <response_url></response_url> 
 <show_packet>1</show_packet> 
 </request>
 

Answer
 <request>
 <version>0.4</version> 
 <status>success</status> 
 <timestamp>1470312323</timestamp> 
 <user_id>12044</user_id> 
 <use_hash>0</use_hash> 
 <hall_id>255</hall_id> 
 <operation>log</operation> 
 <log_id>5951155076</log_id> 
 <log_date>2016-07-31 12:26:02</log_date> 
 <log_bet>500</log_bet> 
 <log_win>1000</log_win> 
 <log_betline>0</log_betline> 
 <log_lines>0</log_lines> 
 <log_balance>3327000</log_balance> 
 <log_gname>Deuces Wild</log_gname>
 <log_html>PHRhYmxlIHdpZHRoPSIxMDAlIiBib3JkZXI9IjAiIGNlbGxzcGFjaW5nPSIwIiBjZWxscGFkZGluZz0iMCI+CgoJICAgICAgICAgICAgICAgIDx0cj48dGQgYmdjb2xvcj0iNDQwMDAwIj4KCgkgICAgICAgICAgICAgICAgICAgICAgICA8dGFibGUgd2lkdGg9IjEwMCUiIGhlaWdodD0iMTAwJSIgIGNlbGxzcGFjaW5nPSIxIiBjZWxscGFkZGluZz0iMSIgIGJvcmRlcj0iMCI+CgoJICAgICAgICAgICAgICAgICAgICAgICAgICAgIAoKCSAgICAgICAgICAgICAgICAgICAgICAgICAgICA8dHIgYmdjb2xvcj0iIzhGMDAwMCI+CgoJICAgICAgICAgICAgICAgICAgICAgICAgICAgIDx0ZCBhbGlnbj0iY2VudGVyIiA+R2FtZSBpbmZvcm1hdGlvbjogRGV1Y2VzIFdpbGQgPGJyIC8+CgoJICAgICAgICAgICAgICAgICAgICAgICAgICAgICgyMDE2LTA3LTMxIDEyOjI2OjAyKTwvdGQ+CgoJICAgICAgICAgICAgICAgICAgICAgICAgICAgIDwvdHI+PHRhYmxlIGJvcmRlcj0iMCIgY2VsbHNwYWNpbmc9IjAiIGNlbGxwYWRkaW5nPSIwIiB3aWR0aD0iMTAwJSI+PHRyPjx0ZCBhbGlnbj0iY2VudGVyIj48dGFibGUgYm9yZGVyPSIwIiBjZWxsc3BhY2luZz0iMCIgY2VsbHBhZGRpbmc9IjAiPjx0cj48dHI+PHRkPkJFVDo8L3RkPjx0ZD41LjAwPC90ZD48L3RyPjx0cj48dGQ+V0lOOjwvdGQ+PHRkPjEwLjAwPC90ZD48L3RyPjx0cj48dGQ+QkFMQU5DRTo8L3RkPjx0ZD4zMzI3MC4wMDwvdGQ+PC90cj48L3RyPjwvdGFibGU+PC90ZD48L3RyPjx0cj48dGQgYWxpZ249ImNlbnRlciI+PHRhYmxlIGJvcmRlcj0iMCIgY2VsbHNwYWNpbmc9IjAiIGNlbGxwYWRkaW5nPSIwIj48dHI+PHRkPjxpbWcgc3JjPSJodHRwczovL2FwaXNlcnZlci5zb2x1dGlvbnMvaW1nL2JhcmFiYW4vY2FyZHMvYmlnLzEwLmpwZyIgd2lkdGg9IjkwIiBoaWdodD0iMTAwIi8+PC90ZD48dGQ+PGltZyBzcmM9Imh0dHBzOi8vYXBpc2VydmVyLnNvbHV0aW9ucy9pbWcvYmFyYWJhbi9jYXJkcy9iaWcvOS5qcGciIHdpZHRoPSI5MCIgaGlnaHQ9IjEwMCIvPjwvdGQ+PHRkPjxpbWcgc3JjPSJodHRwczovL2FwaXNlcnZlci5zb2x1dGlvbnMvaW1nL2JhcmFiYW4vY2FyZHMvYmlnLzguanBnIiB3aWR0aD0iOTAiIGhpZ2h0PSIxMDAiLz48L3RkPjx0ZD48aW1nIHNyYz0iaHR0cHM6Ly9hcGlzZXJ2ZXIuc29sdXRpb25zL2ltZy9iYXJhYmFuL2NhcmRzL2JpZy8yNS5qcGciIHdpZHRoPSI5MCIgaGlnaHQ9IjEwMCIvPjwvdGQ+PHRkPjxpbWcgc3JjPSJodHRwczovL2FwaXNlcnZlci5zb2x1dGlvbnMvaW1nL2JhcmFiYW4vY2FyZHMvYmlnLzM5LmpwZyIgd2lkdGg9IjkwIiBoaWdodD0iMTAwIi8+PC90ZD48L3RyPjwvdGFibGU+PC90ZD48L3RyPjwvdGFibGU+PHRhYmxlIGJvcmRlcj0iMCIgY2VsbHNwYWNpbmc9IjAiIGNlbGxwYWRkaW5nPSIwIiB3aWR0aD0iMTAwJSI+PHRyPjx0ZCBhbGlnbj0iY2VudGVyIj48dGFibGUgYm9yZGVyPSIwIiBjZWxsc3BhY2luZz0iMCIgY2VsbHBhZGRpbmc9IjAiPjx0cj48dGQ+PGltZyBzcmM9Imh0dHBzOi8vYXBpc2VydmVyLnNvbHV0aW9ucy9pbWcvYmFyYWJhbi9jYXJkcy9iaWcvMTAuanBnIiB3aWR0aD0iOTAiIGhpZ2h0PSIxMDAiLz48L3RkPjx0ZD48aW1nIHNyYz0iaHR0cHM6Ly9hcGlzZXJ2ZXIuc29sdXRpb25zL2ltZy9iYXJhYmFuL2NhcmRzL2JpZy85LmpwZyIgd2lkdGg9IjkwIiBoaWdodD0iMTAwIi8+PC90ZD48dGQ+PGltZyBzcmM9Imh0dHBzOi8vYXBpc2VydmVyLnNvbHV0aW9ucy9pbWcvYmFyYWJhbi9jYXJkcy9iaWcvOC5qcGciIHdpZHRoPSI5MCIgaGlnaHQ9IjEwMCIvPjwvdGQ+PHRkPjxpbWcgc3JjPSJodHRwczovL2FwaXNlcnZlci5zb2x1dGlvbnMvaW1nL2JhcmFiYW4vY2FyZHMvYmlnLzI1LmpwZyIgd2lkdGg9IjkwIiBoaWdodD0iMTAwIi8+PC90ZD48dGQ+PGltZyBzcmM9Imh0dHBzOi8vYXBpc2VydmVyLnNvbHV0aW9ucy9pbWcvYmFyYWJhbi9jYXJkcy9iaWcvMzkuanBnIiB3aWR0aD0iOTAiIGhpZ2h0PSIxMDAiLz48L3RkPjwvdHI+PC90YWJsZT48L3RkPjwvdHI+PC90YWJsZT48L3RhYmxlPjwvdGQ+PC90cj48L3RhYmxlPgoKCQk8dGFibGUgc3R5bGU9IndpZHRoOiAxMDAlIj48dHI+CgoJCTx0ZCBzdHlsZT0id2lkdGg6NTAlOyB0ZXh0LWFsaWduOmxlZnQ7Ij48aW5wdXQgdHlwZT0iYnV0dG9uIiB2YWx1ZT0iJmx0OyZsdDsiIG9uY2xpY2s9IndpbmRvdy5sb2NhdGlvbj0naHR0cHM6Ly9hcGlzZXJ2ZXIuc29sdXRpb25zL3JlbW90ZWNhYj9hY3Q9bG9nJmxvZ19pZD01OTUxMTUwMjM0JyIgLz48L3RkPgoKCQk8dGQgc3R5bGU9IndpZHRoOjUwJTsgdGV4dC1hbGlnbjpyaWdodDsiPjxpbnB1dCB0eXBlPSJidXR0b24iIHZhbHVlPSImZ3Q7Jmd0OyIgb25jbGljaz0id2luZG93LmxvY2F0aW9uPSdodHRwczovL2FwaXNlcnZlci5zb2x1dGlvbnMvcmVtb3RlY2FiP2FjdD1sb2cmbG9nX2lkPTU5NTExNDk5NzAnIiAvPjwvdGQ+CgoJCTwvdHI+PC90YWJsZT4=</log_html> 
 <md5>9986a56907868571b3f15ec5579f0748</md5> 
 </request>


Receiving a list of game logs (new version)

The operation is performed by sending an XML-request using the POST method to https://apiserver.solutions/remotecab_game_history

Required fields in the XML-request:

Field Type Required Description
version float Yes API version. It should be 0.5
hall_id integer Yes Hall ID
operation string Yes Operation type get_full_list - get logs list for the period.
period_start datetime Yes Selection period start. The format is YEAR-MONTH-DAY HOUR:MINUTE:SECOND. For the operation list only
period_end datetime Yes Selection period end. The format YEAR-MONTH-DAY HOUR:MINUTE:SECOND. For the operation list only
show_packet smallint Yes, if response_url is not specified If the parameter is equal 1, the result of the XML request will be given to the calling script. Otherwise, the result will be sent to the address passed in the parameter response_url
response_url string If the parameter show_packet is equal 0 The address whereon the result of the XML-request is sent, if the parameter show_packet is equal 0. Sending is performed using the POST method.

Note: difference between the start and the end of the period cannot exceed six days.

Also a digital signature should be formed as md5(hall_secret + XML_request (string) + hall_secret), where hall_secret is the secret word of the hall

Noted restrictions: The maximum period of selection is 14 days. Logs are stored on our server for not more than 14 days. We recommend you to select logs every hour and put them into your database. It will reduce load on the server and increase speed of your system operating. Analyzing game log information we separately give a formed html-code (base64 encoded) as information analysis is performed on our side. Pictures from a log have links to our server.

If the request is successful, you will received a base64 format encoded XML packet and the packet signature. The packet will contain the following fields:

Field Type Description
version float API version
status string Operation status. If it is successful - success; in case of failure - failure.
code string Error code
hall_id integer User hall number
logs_count integer Number of records
operation string Selected operation
timestamp bigint Timestamp in UNIX timestamp format

Game log array content

Field Type Description
dataid bigint Game log ID
gameid integer Game index
uid integer Player id
type bigint System log type in our database
freegame smallint 1 -free game log, 0- normal log
date datetime Game day and time, the format is YEAR-MONTH-DAY HOUR:MINUTE:SECOND
bet bigint Field BET (bet)
win bigint Field WIN (win)
lines bigint Field LINES
balance bigint User balance
gname string Game name

In case of failure the field code the the packet will contain an error code:

Error code Description
request_not_exists Required fields (reg_xml) are not found in POST request
invalid_xml_sended Incorrectly formed XML document
wrong_api_version Incorrect API version ( 0.5 are 0.4 supported)
required_fields_are_empty Not all required fields in the XML-request are filled
no_path_to_send_packet The parameter show_packet is equal 0, response_url is not specified
wrong_hallid Hall ID is specified incorrectly
hall_secret_is_wrong Wrong hall secret
time_periods_are_empty The error is given if operation = list, if the field period_start, or period_end is empty
invalid_date_format Incorrect date format in the fields period_start, or period_end.
time_period_more_that_six_days Selection period exceeds 6 days. (60*60*24*6)
invalid_operation_name The field operation is filled incorrectly. list and log are accepted.




Data protection


Information security is very important in modern business. Any leak of your data can become a serious problem.

StarGame works to provide security and offers a unique solution. Our security system is easy to install and safe. It will encrypt and make all sensible information on your computers invisible.

Key features of our system:

Impossibility to detect hidden information.

Your data encryption is carried out by TrueCrypt. Over the past 10 years this software proved itself as reliable tool of encrypting and hiding sensible information on computers.

Encrypted information looks like random bytes, and its content cannot be recognized.

If your computers are lost or stolen, nobody will be able to detect any hidden information or software on them, as well as to get access to your logins and passwords, even using modern analyzing techniques in cryptographic laboratories.

This is confirmed by an independent audit of TrueCrypt in 2014, which drew a conclusion that the software does not have any problems with security or intentional weakening of encryption for allowing access to developers or security services to encrypted information.

Impossibility to capture a password.

All passwords on your encrypted data are created and securely stored on our servers. The passwords are not stored on your computers, and nobody is aware of them.

Centralized management.

Operator software is installed on one of your computers to administrate all your assigned computers. Using this operator PC you can run or stop software on any of your computers or on all of them together.

Our system is equipped with an alarm button.

Our system is equipped with an alarm button that allows you to instantly block all logins and passwords, stop software, make all you sensible information invisible and lock all your encryption keys on our server.

After pressing the alarm button it will not be possible to access your information and re-run software on your computers. Your encryption keys will remain locked on our server, and in this case it is impossible to decrypt any information stored on your computer and get access to it.

When you want to restore access to encrypted information, please, contact us, and we will restore it. Your settings will not disappear and your software will run again.

Easy installation

Our security system is installed within several minutes. We can provide you with all instructions for installation. If you have any problems, please, contact us, and our experts will arrange remote access to your PC and install the system.




Integration types

Integration example

Introduction

Integration into your game system occurs as follows. When you register a player on your website, you must also register him in our system through the appropriate API methods. Under player authorization in your system you must create his session on the game server. This is done using the remote user session control. The received session data should be passed to the game client.

There is a demo mode for games review that does not require user registration.

DEMO mode

The games can be played in the demo mode to allow a player get acquainted with different games. In this case the following session parameters should be sent: SID = 777, KEY1 = 777, KEY2 = 777.

Wins in the demo mode are not saved. A user plays using demo credits that are given automatically, when a game is run in this mode.

Game selector realization

For game selector realization a list of games should be received from a game server. It can be done using different methods. Our example written in PHP describes the method of a request of a game list in JSON format.

Example:

<?php
	$games_json = file_get_contents("https://apiserver.solutions/remote_games_list?format=json");
	$games = json_decode($games_json, true);
?>

Create the game selector that will allow the player to choose games he wants to play.

<?php
foreach ($games["gamelist"] as $family)
{
	$family = $family["family"];

	foreach($family["games"] as $game)
	{
		$result .= "<div class="game" familyid="".$family["id"]."" gameid="".$game["id"]."" gamename="".$game["name"]."" gameurl="".$game["url"]."" isaristocrat="".$game["isaristocrat"]."" style="background-image: url(".$game["icon"].");"></div>";
	}
}

echo $result;
?>

To display the game selector we will create a template for the HTML page that we will use. We will need jQuery and SWFObject libraries as a matter of convenience.

<!DOCTYPE html>
<html>
	<head>
		<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
		<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/swfobject/2.2/swfobject.js"></script>
		<script type="text/javascript">

		</script>
		<style type="text/css" media="screen">
		</style>
	</head>
	<body>
		<div id="main">
			<!--Game selector will be displayed here -->
		</div>
		<div id="overlay"></div>
		<div id="game_container">
		<div id="game_flash"></div>
		</div>
	</body>
</html>

We will need the following set of CSS styles to display page elements correctly.

body, html	{
	margin: 0;
	padding: 0;
	background: #000000;
}
a, img	{
	border: 0;
}
a:active, a:focus, img, div	{
	outline: 0;
}
#main	{
	position: absolute;
	width: 100%;
	height: 100%;
	text-align: center;
	z-index: 1;
}
.game {
	position: relative;
	display: inline-block;
	margin: 5px;
	width: 218px;
	height: 64px;
	background: #000000 0 0 no-repeat;
	cursor: pointer;
}
#overlay	{
	position: fixed;
	width: 100%;
	height: 100%;
	background: rgba(0, 0, 0, 0.85);
	z-index: 1000;
	display: none;
}
#game_container {
	position: absolute;
	width: 800px;
	height: 600px;
	left: 50%;
	margin-left: -400px;
	top: 50%;
	margin-top: -300px;
	z-index: 1001;
	display: none;
}

Moving terminal to a new hall

Terminal move operation is performed through sending an XML request using the POST method to the address https://apiserver.solutions/api_user_move. Note that both halls should have the same currency

The required fields in the incoming XML request:

Field Type Required Description
version float Yes API version. It should be 0.6
user_id integer Yes User ID
hall_id integer Yes Old hall ID
hall_id_new integer Yes New hall ID
show_packet smallint Yes, if response_url is not given If the parameter is equal to 1, the result of the XML request will be given to the calling script. Otherwise, the result will be sent by url address passed in the parameter response_url
response_url string Yes, if the parameter show_packet is equal 0 The address whereon the result of the XML request is sent using the POST method, if the parameter show_packet is equal 0.

Packet sign: type 1 (using hall_secret) IMPORTANT! In this operation, second hall secret should belong to a new hall: md5(hall_secret + XML_request (line) + hall_secret2), where hall_secret - current hall secret , hall_secret2 - new hall secret

Request example:

<?php
	//Packet sign
	$signature = md5($secret_word.$XML_REQUEST.$secret_word2);

	//Encoding XML-request with base64_encode
	$base64_result = base64_encode($XML_REQUEST);

	//Array of data to be sent to server
	$post_request = array(
									'reg_xml' => $base64_result,
									'reg_sign' => $signature
								);

	//cURL initialization
	$ch = curl_init();

	//Setting cURL options
	curl_setopt($ch, CURLOPT_URL, 'https://apiserver.solutions/api_user_move');
	curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
	curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
	curl_setopt($ch, CURLOPT_POST, 1);

	//Data to be sent via CURl
	curl_setopt($ch, CURLOPT_POSTFIELDS, $post_request);

	//Enabling SSL
	curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 1);

	//Fulfilling the request
	$result = curl_exec($ch);
?>

If the request is successful, you will receive a base64 format encoded XML packet and the packet signature. The packet contains the following fields:

Field Type Description
version float API version
status string Operation status. If it is successful - success; in case of failure - failure.
code string Error code (in case of failure only)
hall_id integer User hall ID
hall_id_new integer New hall ID
time bigint Timestamp in unix timestamp format
user_id integer User ID

In case of failure the field code in the packet will contain an error code:

Error code Description
request_not_exists Required fields (reg_xml) are not found in POST request
invalid_xml_format Incorrectly formed XML document of the request
required_fields_are_empty Not all required fields in XML request are filled
wrong_userid Wrong user_id
user_not_isset This user does not exist
wrong_signature Hall secret word is specified incorrectly
wrong_api_version API version is specified incorrectly
hall_not_exist The hall does not exist
halls_belongs_to_different_managers The halls belong to different superagents ( different agents are allowed,however we don't recommend change the owners because of the statistic change )
halls_have_different_currencies The halls have different currencies
user_hall_wrong Old user hall is not correct (does not belong to the user)

Outgoing XML request example:

<request>
	<version>0.6</version>
	<hall_id>125</hall_id>
    <hall_id_new>126</hall_id_new>
	<user_id>345</user_id>
	<show_packet>1</show_packet>
	<response_url></response_url>
</request>

Example of server response in case of valid request:

<request>
	<version>0.6</version>
	<status>success</status>
	<user_id>345</user_id>
	<hall_id>125</hall_id>
	<hall_id_new>126</hall_id_new>
	<time>1390780004</time>
</request>

Example of response in case of a failure:

<request>
	<version>0.6</version>
	<status>failure</status>
	<code>hall_not_exist</code>
	<hall_id>125</hall_id>
</request>

Wallet API

Wallet API allows to use our system with third-party payment processing.

To enable wallet API for your hall, you should add your server address in admin panel. In order to do this, open the hall page, go to Hall settings, and find "Wallet API" field in General hall settings section. Enter your server name and press save button. You may find more details in documentation

Games display on webpage

2 kinds of games output are available

  1. 1. using postMessage (HTML5)
  2. 2. using JavaScript based fast integration (recommended)
  3. 3. direct integration

Using HTML5

Closing the popup window with the game via the button Cashout is performed through postMessage when a message is received. It is Close by our server. You can see an example below (using the jQuery plugin Facebox as window popup. If you use a regular popup window, change $ .facebox.close (); to window.close (); or to any other handler depending on the library):

<script type="text/javascript">
        window.addEventListener("message", function(event) {
            var msg = event.data.msg;
            switch(msg) {
                case "panic":
                    location.replace(event.data.url);
                    break;
                case "closeGame":
                    $('.modal-close').click();
                    break;
            }


        });
</script>

Example of game running by id:

<script type="text/javascript">
    function doStartGame(gameid, login, pass ) {
        var commandline = 'https://apiserver.solutions/tote_opbetting3?gameid=' + gameid + '&
                          ulogin='+ login + '&upass=' +pass+'&x=' + Math.random() +
                          "jsoncallback=?";

        if (login=='none')
            window.location.href = "/login";

        var html = '<iframesrc="' + commandline + '" width="450"
                     height="340" align="left">Your browser doesn not support iframes!
                   </iframe>';

        $.facebox(html);
        return false;
    }
</script>

For text marked in red, see remarks in the end of the document

Games list output by reference to authorization:

<div class="games">
  <?php
    $i = 1;
    foreach($games as $game):
  ?>
  <div class="images-overview <?php echo ($i % 4 == 0 ? 'last' : ''); ?>">
     <span><?php echo $game['name']; ?></span>
     <img src="<?php echo $game['icon']; ?>" alt="
            <?php echo $game['id']; ?>" title="<?php echo $game['id']; ?>">
     <a href="#" title="<?php echo $game['name']; ?>"
            onclick="return doStartGame( <?php echo $game['gid']; ?>,
            <?php echo $login; ?>,<?php echo $pass; ?>;">
     <span class="text-link">play</span></a>
     <div class="details">
        <p><?php echo $game['name']; ?></p>
     </div>
  </div>
  <?php $i++;
     endforeach;
  ?>
</div>

where $login – user login in the system, $pass - md5 from user password in the system

If the user is not logged, you should add event handler to redirect to login page in your system.

If the user did not log in, you should add the handler and redirect it to the login page in your system. In the example of id game running, if there is no login, $login='none', add ( clause 5.1) redirection to the login page of your website to flash game call function (it is marked with the red color in the example):

<script type="text/javascript">
function doStartGame(gameid, login, pass){
   var commandline = 'https://apiserver.solutions/tote_opbetting3?gameid=' + gameid + '&
                     ulogin=' + login + '&upass=' +pass+'&x=' + Math.random() + "
                     jsoncallback=?";

   if (login=='none')
      window.location.href = "/login";

   var html = '<iframe src="' + commandline + '" width="800"
                        height="600" align="left">
                        Your browser does not support iframes!</iframe>';

   $.facebox(html);
   return false;
}
</script>

Fast integration (recommended)

Fast integration allows you to place the games on your website without spending time on API realization. You will need only to add several lines of program code to your page.

To run a game on your website you need to be registered as an agent in our system, to have a current hall and users that are attached to the hall. For registration in our system, please, contact our manager. See the information in "Contacts". 1334, game hall number 1890, hall secret word secret, game id 219.

<script type="text/javascript" charset="utf-8">
var starconfig = {
	login: 1334,
	hash: "1a250ab682fd877c2117c87addf312e4",
	gameid: 219,
	width: 1024,
	height: 788,
	balanceChange: "changeMyBalance",
	closeWindow: "closeMyWindow",
	logo:  'My Company',
	logoword: 'CompanyName',
};
</script>
<script type="text/javascript" src="http://stargame.solutions/embed/embed.js" charset="utf-8"></script>

The following parameters should be sent:

Parameter name Required Description
login Yes Login (game terminal id)
hash Yes md5 digest from line concatenation (hall number + secret word + user id)
gameid Yes Game id
width No Game window width
height No Game window height
balanceChange No A name of the Javascript function that is invoked by a game on your page, when user balance is changed
closeWindow No A name of the javascript function that is invoked by a game on your page, when the tab is closed.
logo No Copyright text in the lower right corner of the game window (is shown during launching a game). Maximum 20 characters ,spaces and numbers allowed
logoword No Copyright text. Shown on game load. Only latin characters allowed. No spaces . Maximum 9 characters.

The optimal size of a game window is 1024x788 for aristocrats type of games and 800x600 for the other games. If you set game window size that differs from the optimal, the original height-to width aspect ratio should be succeeded. You can see window sizes in API games list. Game window height and width can be set in percents.

<script type="text/javascript" charset="utf-8">
var starconfig = {
	login: 1334,
	hash: "1a250ab682fd877c2117c87addf312e4",
	gameid: 114,
	width: "80%",
	height: "80%"
};
</script>
<script type="text/javascript" src="http://mainamagames.com/embed2.js" charset="utf-8"></script>

Direct integration (using direct link to the flash loader)

To implement on your site, use direct link https://apiserver.solutions/public/tote/GameLoader.swf.

Example of js script to run games:

   <script type="text/javascript">
       function doStartGameAll(gameid, login, pass) {
         if(login == 'none')
           window.location.href = "/login";

         var commandline = "";
         $.ajax({
           url: " /frame?gameid=" + gameid,
           type: "GET",
           success: function(results){
              commandline = results;
           },
           complete: function(){
              $.facebox(commandline);
           },
           error: function(xhr,err){

           }
         });
       }
   </script>

Example above opens facebox window with page containing the Flash-loader. You should pass 4 parameters to the script generating this page: - sid, key1, key2, config.

Session parameters for demo sites: sid – 777, key1 – 777, key2 – 777, config - https://apiserver.solutions/flashconfig.php

Example of a game page (a page with the Flash-loader):

  <?php
    <script type="text/javascript">
    function thisMovie(movieName) {
       if (navigator.appName.indexOf("Microsoft") != -1){
          return window[movieName];
       } else {
          return document[movieName];
       }
    }

    function callFlashMethod() {
       document.getElementById('flashapp').externalClose();
    }

    function closePopup(){
       callFlashMethod();
       $.facebox.close();
       return false;
    }


    </script>


<div>
  <object id="_MainApp" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
        width="<? echo $width;?>" height="<? echo $height;?>"
        wmode="direct" allowscriptaccess="always">
    <param name="movie" value="https://apiserver.solutions/public/tote/GameLoader.swf" />
    <param name="allowfullscreen" value="true" />
    <param name="wmode" value="direct" />
    <param name="allowscriptaccess" value="always" />
    <param name="flashvars" value="SID=<? echo $sid;?>&KEY1=
        <? echo $key1;?>&KEY2=<? echo $key2;?>&gameid=<? echo $gid;?>&
        config=<? echo $config;?>" />
      <!-- [if !IE]> -->
      <object type="application/x-shockwave-flash" id="flashapp" wmode="direct"
            allowscriptaccess="always" allowfullscreen="true"
            data="https://apiserver.solutions/public/tote/GameLoader.swf"
            width="<? echo $width;?>" height= "<? echo $height;?>"
            flashvars="SID=<? echo $sid;?>&KEY1=<? echo $key1;?>&KEY2=<? echo $key2;?>
            &gameid=<? echo $gid;?>&config=<? echo $config;?>" >
         <param name="wmode" value="direct" />
		   <param name="allowscriptaccess" value="always" />
		    <param name="allowfullscreen" value="true" />
    <param name="flashvars" value="SID=<? echo $sid;?>&KEY1=
        <? echo $key1;?>&KEY2=<? echo $key2;?>&gameid=<? echo $gid;?>&
        config=<? echo $config;?>" />
      <!-- <![endif] -->
         <div>
           <h3>_MainApp</h3>
         </div>
      <!-- [if !IE]> -->
        </object>
      <!-- <![endif] -->
  </object>
</div>
?>

Js function closePopup() is used to close the game window from a website side (not with Cashout button). If it is not present, the "close" button is not displayed in game window. It makes additional call to callFlashMethod() function, which calls flash game function externalClose();. It is required for balance to be correctly saved on your site during game process. See remark 2* for real time balancechange

Variables $width and $height contains the width and the height of the popup game window. In case of common flash games: $width= 800px, $height=600px, in case of aristocrats, - 1024px , 768px. We recommend to adapt popup window size for each game, to fit original game proportions.

Remarks

Remark 1:

* To change balance in real time, add js function gameBalanceChange(amount). Also bind externalClose() event to flash game exit event. Flash game will pass updated balance to gameBalanceChange function in real time. Once the user closed the game, externalClose() function guaranties data integrity ( for example in case when reels are not stopped but the user closed the window)

Example of gameBalanceChange function:

<script type="text/javascript">
  functiongameBalanceChange(amount) {
     var am = amount;
     $('#balance').html(am);
     $.ajax({
        type: "POST",
        url: "/ru-RU/usercab?changebalance=1",
        data: {amount: am},
        success: function(data) {
        }
     });
  }
</script>