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>json games array * </gamelist>* json games array structure:
{"gamelist": [{"family": {"id":6,"name":"coolfire 2","games":[ {"id":174,"name":"Coyote Cash","icon":"https://content.stargame.solutions/api/game/icon2/174","width":800,"height":600}, {"id":254,"name":"Fairy Queen","icon":"https://content.stargame.solutions/api/game/icon2/254","width":1920,"height":1080}, ..... ]}}], "gamescount":160, "actualdate":"2018-01-15 11:16:06"}
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 here
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)
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".
<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="https://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. Game window height and width can be set in percents.