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"
]
}
}Mercados
Obtener ligas
Lista ligas con mercados activos
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"
]
}
}Devuelve cada liga con mercados activos en el intercambio. Usa los códigos de liga de este endpoint para obtener juegos (
/exchange/v2/getGames) y libros de órdenes (/exchange/v2/getOrderbook).
Si la respuesta contiene un nombre de liga con LIVE (aparte de las ligas en vivo por deporte NFL-LIVE, NBA-LIVE, NCAAF-LIVE, NCAAB-LIVE), se agrega el valor "LIVE" como alias de “todos los juegos en curso”.
Solicitud
GET /exchange/getLeagues
string
Filtro opcional de deporte (
basketball, baseball, hockey, football, soccer, golf, tennis, mma, etc.). Cuando sport=soccer o sport=golf, se agrega el valor "all" a la lista.curl https://api.4casters.io/exchange/getLeagues \
-H "Authorization: Bearer YOUR_TOKEN"
Respuesta
array
Array de códigos de liga.
Ejemplo
{
"data": {
"availableLeagues": [
"CHAMPIONS-LEAGUE",
"NBA",
"NHL",
"BUNDESLIGA",
"PREMIER-LEAGUE",
"PGA",
"LA-LIGA",
"NON-UFC",
"SERIE-A",
"MLS",
"UFCMMA"
]
}
}
Autorizaciones
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.
Parámetros de consulta
Optional sport filter (e.g. basketball, soccer, golf). When sport=soccer or sport=golf, all is appended to the list.
Respuesta
Available leagues
Show child attributes
Show child attributes
¿Esta página le ayudó?