Pass Data to RGS-CWS API Endpoints
๐ Communication Protocol
Protocol:
HTTP POSTMethod:
RESTful JSON APIContent-Type Header:
application/jsonTimestamp Format:
YYYY-MM-DD HH:mm:ssExample:
2024-04-25 19:35:33
Essential credentials required to integrate: API Username (apiusername), API Password (apipass), REST API URL, Operator ID
๐งพ POST Body Format
The POST body must contain a valid JSON object with the parameters required for the requested command. EG: {"command": "getListGames", "apiusername": "testAdmin1", "apipass": "testAdminPass1"}
Use json_encode($request_data) in PHP or the equivalent in other languages.
Sample code for sending a POST command via CURL:
Example<?php
$cws_api = [
'apiusername' => 'rgs_demo_testXXXXXX',//replace with your given api username
'apipass' => 'rgs_demo_passXXXXXX',//replace with your given api password
'restapi_url' => 'https://************.casino/restapi_url.php',//replace with our given REST API URL
];
$request_data = [
'command' => 'getListGames', // command used for getting list of games
'apiusername' => $cws_api['apiusername'],
'apipass' => $cws_api['apipass'],
];
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => $cws_api['restapi_url'],//replace with REST API URL
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => json_encode($request_data, JSON_UNESCAPED_SLASHES),
CURLOPT_CONNECTTIMEOUT => 30,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_HTTPHEADER => [
'Content-Type: application/json',
'Accept: application/json',
],
]);
$response = curl_exec($curl);
$httpCode = curl_getinfo($curl, CURLINFO_HTTP_CODE);
$curlErr = curl_error($curl);
curl_close($curl);
// Handle transport errors
if ($response === false) {
die("cURL error: $curlErr\n");
// Show HTTP status for quick debugging
echo "HTTP $httpCode\n";
}else{
//process the response
//print_r($response);
}
//DISCLAIMER: the above sample code is written by our team and tested to work
๐งพ Data Format Notes
All parameters must be passed as JSON-encoded data.
Data types:
Any fields can be of type
string, even numbersIf you prefer to not send numbers as strings, then please note that some numerical values can be passed as
int
โ ๏ธ Do not pass raw
float! Usestringforfloats
โก๏ธ REST API Endpoint URL
The REST API URL you're supposed to use was provided by CWS Support when your operator account was configured.
Refer to this as your:REST API URL (e.g., https://www.cryptoclub.casino/wwwmisc/API/restapi_url.php)
๐ Where to Find Parameter Details
For a list of required parameters and request structures per command:
See the documentation sections:
Main Endpoints
Advanced Endpoints
๐งโ๐ป Code Samples
If you require code samples in PHP for getting list of games, launching the games, please contact us.