Get leagues
curl --request GET \
--url https://api.4casters.io/exchange/getLeagues \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.4casters.io/exchange/getLeagues"
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/exchange/getLeagues', 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/exchange/getLeagues",
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/exchange/getLeagues"
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/exchange/getLeagues")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.4casters.io/exchange/getLeagues")
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{
"data": {
"availableLeagues": [
"NBA",
"NHL",
"PREMIER-LEAGUE",
"PGA"
]
}
}市場
獲取聯賽
列出有活躍市場的聯賽
GET
/
exchange
/
getLeagues
Get leagues
curl --request GET \
--url https://api.4casters.io/exchange/getLeagues \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.4casters.io/exchange/getLeagues"
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/exchange/getLeagues', 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/exchange/getLeagues",
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/exchange/getLeagues"
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/exchange/getLeagues")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.4casters.io/exchange/getLeagues")
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{
"data": {
"availableLeagues": [
"NBA",
"NHL",
"PREMIER-LEAGUE",
"PGA"
]
}
}回傳交易所上所有有活躍市場的聯賽。使用此端點的聯賽代碼獲取賽事(
/exchange/v2/getGames)和訂單簿(/exchange/v2/getOrderbook)。
如果回應中的聯賽名稱包含 LIVE(除按運動項目劃分的滾球聯賽 NFL-LIVE、NBA-LIVE、NCAAF-LIVE、NCAAB-LIVE 外),會追加值 "LIVE" 作為「全部進行中賽事」的別名。
請求
GET /exchange/getLeagues
string
可選的運動項目過濾(
basketball、baseball、hockey、football、soccer、golf、tennis、mma 等)。當 sport=soccer 或 sport=golf 時,列表會追加 "all"。curl https://api.4casters.io/exchange/getLeagues \
-H "Authorization: Bearer YOUR_TOKEN"
回應
array
聯賽代碼陣列。
示例
{
"data": {
"availableLeagues": [
"CHAMPIONS-LEAGUE",
"NBA",
"NHL",
"BUNDESLIGA",
"PREMIER-LEAGUE",
"PGA",
"LA-LIGA",
"NON-UFC",
"SERIE-A",
"MLS",
"UFCMMA"
]
}
}
授權
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.
查詢參數
Optional sport filter (e.g. basketball, soccer, golf). When sport=soccer or sport=golf, all is appended to the list.
回應
Available leagues
Show child attributes
Show child attributes
這個頁面有幫助嗎?