Get bet by ID or txID
curl --request GET \
--url https://api.4casters.io/user/getBetByID \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.4casters.io/user/getBetByID"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.4casters.io/user/getBetByID', 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.4casters.io/user/getBetByID",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.4casters.io/user/getBetByID"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.4casters.io/user/getBetByID")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.4casters.io/user/getBetByID")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"bet": {
"id": "<string>",
"txID": "<string>",
"type": "moneyline",
"bet": 123,
"odds": 123,
"spread": 123,
"total": 123,
"OU": "over",
"participantID": "<string>",
"market": "<string>",
"side": "<string>",
"userReference": "<string>",
"createdAt": "2023-11-07T05:31:56Z",
"matchedTime": "2023-11-07T05:31:56Z",
"graded": true,
"closed": true,
"origin": "<string>",
"adminRefund": true,
"risk": "<string>",
"win": "<string>",
"game": {
"id": "<string>",
"league": "<string>",
"sport": "<string>",
"start": "2023-11-07T05:31:56Z",
"ended": true,
"eventName": "<string>",
"isFutures": true,
"participants": [
{
"id": "<string>",
"longName": "<string>",
"shortName": "<string>",
"homeAway": "home",
"mainPitcher": "<string>",
"rotationNumber": "<string>",
"futuresSide": "<string>",
"score": 123
}
]
}
}
}使用者
按 ID 獲取投注
按 id 或事務 id 查詢單筆投注
GET
/
user
/
getBetByID
Get bet by ID or txID
curl --request GET \
--url https://api.4casters.io/user/getBetByID \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.4casters.io/user/getBetByID"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.4casters.io/user/getBetByID', 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.4casters.io/user/getBetByID",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.4casters.io/user/getBetByID"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.4casters.io/user/getBetByID")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.4casters.io/user/getBetByID")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"bet": {
"id": "<string>",
"txID": "<string>",
"type": "moneyline",
"bet": 123,
"odds": 123,
"spread": 123,
"total": 123,
"OU": "over",
"participantID": "<string>",
"market": "<string>",
"side": "<string>",
"userReference": "<string>",
"createdAt": "2023-11-07T05:31:56Z",
"matchedTime": "2023-11-07T05:31:56Z",
"graded": true,
"closed": true,
"origin": "<string>",
"adminRefund": true,
"risk": "<string>",
"win": "<string>",
"game": {
"id": "<string>",
"league": "<string>",
"sport": "<string>",
"start": "2023-11-07T05:31:56Z",
"ended": true,
"eventName": "<string>",
"isFutures": true,
"participants": [
{
"id": "<string>",
"longName": "<string>",
"shortName": "<string>",
"homeAway": "home",
"mainPitcher": "<string>",
"rotationNumber": "<string>",
"futuresSide": "<string>",
"score": 123
}
]
}
}
}查詢屬於呼叫方的單筆投注(已撮合、已結算或未成交掛單)。傳入
必須恰好傳入
id 或 txID 之一,不要同時傳入。
請求
GET /user/getBetByID
string
來自列表端點(例如
/user/getMatchedBets)的投注 id。string
事務 ID,例如
/session/v3/place 回傳的 wagerRequestID 或 txID。id 或 txID 之一。
curl "https://api.4casters.io/user/getBetByID?txID=64824b329556daa319747e31" \
-H "Authorization: Bearer YOUR_TOKEN"
curl "https://api.4casters.io/user/getBetByID?id=6494ca85c9346058f35b2b1e" \
-H "Authorization: Bearer YOUR_TOKEN"
回應
bet 的形態取決於投注的當前狀態:
- 已結算投注回傳 GradedWager 形態,包含
risk、win、fee和result。 - 已撮合投注回傳 MatchedBet 形態。
- 未成交掛單回傳 UnmatchedOrder 形態。
data 下)。
示例
{
"bet": {
"id": "667c1e870c0d22ec36ccb438",
"txID": "667c1e870c0d22ec36ccb439",
"type": "moneyline",
"bet": 222,
"graded": false,
"closed": false,
"createdAt": "2024-06-26T13:58:31.224Z",
"origin": "offer",
"wagerRequestID": "667c1e870c...",
"game": {
"id": "6679ee8c9f05a804e064b6ed",
"league": "FED-EX-500",
"sport": "golf",
"start": "2024-06-27T10:45:00.000Z",
"ended": false,
"participants": [/* ... */]
}
}
}
錯誤
| 狀態 | 含義 |
|---|---|
400 | id 和 txID 均缺失,或未找到所提供識別碼對應的投注。 |
授權
Pass your auth token in the Authorization header. The Bearer prefix is optional; the server also accepts a signed auth cookie or a token field in the request body.
查詢參數
Bet id from a list endpoint.
Transaction id (e.g. wagerRequestID or txID returned from place).
回應
The bet, in matched, graded, or open form depending on its current state.
A bet that has been matched but not yet graded.
- Option 1
- Option 2
- Option 3
Show child attributes
Show child attributes
這個頁面有幫助嗎?