用戶登入
curl --request POST \
--url https://api.example.com/api/v1/dt/game \
--header 'Content-Type: application/json' \
--data '
{
"uuid": "<string>",
"platform_id": "<string>",
"username": "<string>",
"transaction_id": "<string>",
"credit": "<string>",
"key": "<string>",
"lang": "<string>",
"homeUrl": "<string>",
"registerUrl": "<string>",
"depositUrl": "<string>",
"withdrawUrl": "<string>",
"extendSessionUrl": "<string>",
"theme_pid": "<string>",
"title": "<string>",
"favicon": "<string>",
"logoLandscape": "<string>",
"site": "<string>",
"device": "<string>"
}
'import requests
url = "https://api.example.com/api/v1/dt/game"
payload = {
"uuid": "<string>",
"platform_id": "<string>",
"username": "<string>",
"transaction_id": "<string>",
"credit": "<string>",
"key": "<string>",
"lang": "<string>",
"homeUrl": "<string>",
"registerUrl": "<string>",
"depositUrl": "<string>",
"withdrawUrl": "<string>",
"extendSessionUrl": "<string>",
"theme_pid": "<string>",
"title": "<string>",
"favicon": "<string>",
"logoLandscape": "<string>",
"site": "<string>",
"device": "<string>"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
uuid: '<string>',
platform_id: '<string>',
username: '<string>',
transaction_id: '<string>',
credit: '<string>',
key: '<string>',
lang: '<string>',
homeUrl: '<string>',
registerUrl: '<string>',
depositUrl: '<string>',
withdrawUrl: '<string>',
extendSessionUrl: '<string>',
theme_pid: '<string>',
title: '<string>',
favicon: '<string>',
logoLandscape: '<string>',
site: '<string>',
device: '<string>'
})
};
fetch('https://api.example.com/api/v1/dt/game', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/api/v1/dt/game",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'uuid' => '<string>',
'platform_id' => '<string>',
'username' => '<string>',
'transaction_id' => '<string>',
'credit' => '<string>',
'key' => '<string>',
'lang' => '<string>',
'homeUrl' => '<string>',
'registerUrl' => '<string>',
'depositUrl' => '<string>',
'withdrawUrl' => '<string>',
'extendSessionUrl' => '<string>',
'theme_pid' => '<string>',
'title' => '<string>',
'favicon' => '<string>',
'logoLandscape' => '<string>',
'site' => '<string>',
'device' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/api/v1/dt/game"
payload := strings.NewReader("{\n \"uuid\": \"<string>\",\n \"platform_id\": \"<string>\",\n \"username\": \"<string>\",\n \"transaction_id\": \"<string>\",\n \"credit\": \"<string>\",\n \"key\": \"<string>\",\n \"lang\": \"<string>\",\n \"homeUrl\": \"<string>\",\n \"registerUrl\": \"<string>\",\n \"depositUrl\": \"<string>\",\n \"withdrawUrl\": \"<string>\",\n \"extendSessionUrl\": \"<string>\",\n \"theme_pid\": \"<string>\",\n \"title\": \"<string>\",\n \"favicon\": \"<string>\",\n \"logoLandscape\": \"<string>\",\n \"site\": \"<string>\",\n \"device\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.example.com/api/v1/dt/game")
.header("Content-Type", "application/json")
.body("{\n \"uuid\": \"<string>\",\n \"platform_id\": \"<string>\",\n \"username\": \"<string>\",\n \"transaction_id\": \"<string>\",\n \"credit\": \"<string>\",\n \"key\": \"<string>\",\n \"lang\": \"<string>\",\n \"homeUrl\": \"<string>\",\n \"registerUrl\": \"<string>\",\n \"depositUrl\": \"<string>\",\n \"withdrawUrl\": \"<string>\",\n \"extendSessionUrl\": \"<string>\",\n \"theme_pid\": \"<string>\",\n \"title\": \"<string>\",\n \"favicon\": \"<string>\",\n \"logoLandscape\": \"<string>\",\n \"site\": \"<string>\",\n \"device\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/v1/dt/game")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"uuid\": \"<string>\",\n \"platform_id\": \"<string>\",\n \"username\": \"<string>\",\n \"transaction_id\": \"<string>\",\n \"credit\": \"<string>\",\n \"key\": \"<string>\",\n \"lang\": \"<string>\",\n \"homeUrl\": \"<string>\",\n \"registerUrl\": \"<string>\",\n \"depositUrl\": \"<string>\",\n \"withdrawUrl\": \"<string>\",\n \"extendSessionUrl\": \"<string>\",\n \"theme_pid\": \"<string>\",\n \"title\": \"<string>\",\n \"favicon\": \"<string>\",\n \"logoLandscape\": \"<string>\",\n \"site\": \"<string>\",\n \"device\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"url": "https://rel-game.cog888.net?pid=R01C05&token=zL13tWjRw2d0mHJSAkNtyNgjAsfTjavP6e9gQLpsOF-&homeUrl=home®isterUrl=register&depositUrl=deposit&withdrawUrl=withdraw&extendSessionUrl=extend&lang=en-us&closeAppOnLogout=1"
}{
"error": {
"code": 2,
"msg": "request hash signature(0FACF22B9E3DB5CDC670A0F7A65BB76A) is error",
"uuid": "9e96610f-5388-42df-b3ed-ba1b3178c63b"
}
}User API
用戶登入
用戶登入並取得遊戲 URL
POST
/
api
/
v1
/
dt
/
game
用戶登入
curl --request POST \
--url https://api.example.com/api/v1/dt/game \
--header 'Content-Type: application/json' \
--data '
{
"uuid": "<string>",
"platform_id": "<string>",
"username": "<string>",
"transaction_id": "<string>",
"credit": "<string>",
"key": "<string>",
"lang": "<string>",
"homeUrl": "<string>",
"registerUrl": "<string>",
"depositUrl": "<string>",
"withdrawUrl": "<string>",
"extendSessionUrl": "<string>",
"theme_pid": "<string>",
"title": "<string>",
"favicon": "<string>",
"logoLandscape": "<string>",
"site": "<string>",
"device": "<string>"
}
'import requests
url = "https://api.example.com/api/v1/dt/game"
payload = {
"uuid": "<string>",
"platform_id": "<string>",
"username": "<string>",
"transaction_id": "<string>",
"credit": "<string>",
"key": "<string>",
"lang": "<string>",
"homeUrl": "<string>",
"registerUrl": "<string>",
"depositUrl": "<string>",
"withdrawUrl": "<string>",
"extendSessionUrl": "<string>",
"theme_pid": "<string>",
"title": "<string>",
"favicon": "<string>",
"logoLandscape": "<string>",
"site": "<string>",
"device": "<string>"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
uuid: '<string>',
platform_id: '<string>',
username: '<string>',
transaction_id: '<string>',
credit: '<string>',
key: '<string>',
lang: '<string>',
homeUrl: '<string>',
registerUrl: '<string>',
depositUrl: '<string>',
withdrawUrl: '<string>',
extendSessionUrl: '<string>',
theme_pid: '<string>',
title: '<string>',
favicon: '<string>',
logoLandscape: '<string>',
site: '<string>',
device: '<string>'
})
};
fetch('https://api.example.com/api/v1/dt/game', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/api/v1/dt/game",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'uuid' => '<string>',
'platform_id' => '<string>',
'username' => '<string>',
'transaction_id' => '<string>',
'credit' => '<string>',
'key' => '<string>',
'lang' => '<string>',
'homeUrl' => '<string>',
'registerUrl' => '<string>',
'depositUrl' => '<string>',
'withdrawUrl' => '<string>',
'extendSessionUrl' => '<string>',
'theme_pid' => '<string>',
'title' => '<string>',
'favicon' => '<string>',
'logoLandscape' => '<string>',
'site' => '<string>',
'device' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/api/v1/dt/game"
payload := strings.NewReader("{\n \"uuid\": \"<string>\",\n \"platform_id\": \"<string>\",\n \"username\": \"<string>\",\n \"transaction_id\": \"<string>\",\n \"credit\": \"<string>\",\n \"key\": \"<string>\",\n \"lang\": \"<string>\",\n \"homeUrl\": \"<string>\",\n \"registerUrl\": \"<string>\",\n \"depositUrl\": \"<string>\",\n \"withdrawUrl\": \"<string>\",\n \"extendSessionUrl\": \"<string>\",\n \"theme_pid\": \"<string>\",\n \"title\": \"<string>\",\n \"favicon\": \"<string>\",\n \"logoLandscape\": \"<string>\",\n \"site\": \"<string>\",\n \"device\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.example.com/api/v1/dt/game")
.header("Content-Type", "application/json")
.body("{\n \"uuid\": \"<string>\",\n \"platform_id\": \"<string>\",\n \"username\": \"<string>\",\n \"transaction_id\": \"<string>\",\n \"credit\": \"<string>\",\n \"key\": \"<string>\",\n \"lang\": \"<string>\",\n \"homeUrl\": \"<string>\",\n \"registerUrl\": \"<string>\",\n \"depositUrl\": \"<string>\",\n \"withdrawUrl\": \"<string>\",\n \"extendSessionUrl\": \"<string>\",\n \"theme_pid\": \"<string>\",\n \"title\": \"<string>\",\n \"favicon\": \"<string>\",\n \"logoLandscape\": \"<string>\",\n \"site\": \"<string>\",\n \"device\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/v1/dt/game")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"uuid\": \"<string>\",\n \"platform_id\": \"<string>\",\n \"username\": \"<string>\",\n \"transaction_id\": \"<string>\",\n \"credit\": \"<string>\",\n \"key\": \"<string>\",\n \"lang\": \"<string>\",\n \"homeUrl\": \"<string>\",\n \"registerUrl\": \"<string>\",\n \"depositUrl\": \"<string>\",\n \"withdrawUrl\": \"<string>\",\n \"extendSessionUrl\": \"<string>\",\n \"theme_pid\": \"<string>\",\n \"title\": \"<string>\",\n \"favicon\": \"<string>\",\n \"logoLandscape\": \"<string>\",\n \"site\": \"<string>\",\n \"device\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"url": "https://rel-game.cog888.net?pid=R01C05&token=zL13tWjRw2d0mHJSAkNtyNgjAsfTjavP6e9gQLpsOF-&homeUrl=home®isterUrl=register&depositUrl=deposit&withdrawUrl=withdraw&extendSessionUrl=extend&lang=en-us&closeAppOnLogout=1"
}{
"error": {
"code": 2,
"msg": "request hash signature(0FACF22B9E3DB5CDC670A0F7A65BB76A) is error",
"uuid": "9e96610f-5388-42df-b3ed-ba1b3178c63b"
}
}此 API 可能返回的錯誤代碼
此 API 可能返回的錯誤代碼
| 代碼 | 說明 |
|---|---|
| 2 | 無效參數 |
| 10 | 交易序號重複 |
| 36 | 伺服器錯誤 |
| 9999 | 未知錯誤 |
主體
application/json
各平台自定義的唯一性請求序號,長度 >= 32 且 <= 128 字節
平台方的產品 ID
用戶在遊戲中的帳號 (限制長度23字元,且皆為小寫英文或數字)
交易序號 (長度 1~128 字元,僅允許 ASCII 32-126 可列印字元,禁止使用 ` 和 ~)
本次登入所需帶入遊戲中額度
md5(username + credit + transaction_id + 平台密鑰)
語系 (請參考附錄「語系一覽」),選填
現金網首頁,需使用 encodeURIComponent 編碼
現金網註冊網址,需使用 encodeURIComponent 編碼
現金網存款網址,需使用 encodeURIComponent 編碼
現金網取款網址,需使用 encodeURIComponent 編碼
現金網延長 session 網址,需使用 encodeURIComponent 編碼
要顯示的 UI 皮的 pid,未帶入將顯示預設值
網頁分頁上顯示的產品名稱,未帶入將顯示 COG
網頁分頁上顯示的產品 favicon,未帶入將顯示 COG favicon
大廳橫屏顯示的 logo,未帶入將顯示 COG logo
帶入 app 字串,在手機 mobile h5 打橫將不顯示上滑進入全屏遮罩
裝置類型,可帶入 PC 或 MB,未帶入視為 PC;帶入的值會原樣附加至遊戲 URL(device=PC 或 device=MB),未帶入則不附加
回應
成功
導向遊戲平台的 URL
⌘I