Get games
curl --request GET \
--url https://api.4casters.io/exchange/v2/getGames \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.4casters.io/exchange/v2/getGames"
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/v2/getGames', 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/v2/getGames",
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/v2/getGames"
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/v2/getGames")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.4casters.io/exchange/v2/getGames")
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": {
"games": [
{
"id": "<string>",
"parentGameID": "<string>",
"cheapDataUID": "<string>",
"league": "<string>",
"sport": "<string>",
"start": "2023-11-07T05:31:56Z",
"ended": true,
"live": true,
"featured": true,
"eventName": "<string>",
"tournamentName": "<string>",
"periodName": "<string>",
"isSpecials": true,
"participants": [
{
"id": "<string>",
"longName": "<string>",
"shortName": "<string>",
"homeAway": "home",
"mainPitcher": "<string>",
"rotationNumber": "<string>",
"futuresSide": "<string>",
"score": 123
}
]
}
]
}
}Mercados
Obtener juegos
Lista los juegos activos de una liga
GET
/
exchange
/
v2
/
getGames
Get games
curl --request GET \
--url https://api.4casters.io/exchange/v2/getGames \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.4casters.io/exchange/v2/getGames"
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/v2/getGames', 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/v2/getGames",
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/v2/getGames"
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/v2/getGames")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.4casters.io/exchange/v2/getGames")
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": {
"games": [
{
"id": "<string>",
"parentGameID": "<string>",
"cheapDataUID": "<string>",
"league": "<string>",
"sport": "<string>",
"start": "2023-11-07T05:31:56Z",
"ended": true,
"live": true,
"featured": true,
"eventName": "<string>",
"tournamentName": "<string>",
"periodName": "<string>",
"isSpecials": true,
"participants": [
{
"id": "<string>",
"longName": "<string>",
"shortName": "<string>",
"homeAway": "home",
"mainPitcher": "<string>",
"rotationNumber": "<string>",
"futuresSide": "<string>",
"score": 123
}
]
}
]
}
}Devuelve todos los juegos activos de una liga. La respuesta no incluye el libro de órdenes ni ningún precio: llama a Obtener libro de órdenes para eso.
Solicitud
GET /exchange/v2/getGames
string
requerido
Código de liga de Obtener ligas. Usa el valor especial
upcoming para obtener todos los juegos próximos de todas las ligas.string
Filtro opcional de deporte.
curl "https://api.4casters.io/exchange/v2/getGames?league=NBA" \
-H "Authorization: Bearer YOUR_TOKEN"
Respuesta
array
Mostrar Game
Mostrar Game
string
Id del juego.
string
Id del juego padre, si este es un mercado hijo (props, periodos alternativos).
string
Identificador estable entre sistemas del juego (se usa para correlación de líneas).
string
string
string
Hora de inicio en ISO 8601.
boolean
boolean
boolean
string
string
string
p. ej.
Full Time, 1H, Set 1.boolean
true en mercados de futuros y otros especiales.array
Array de dos elementos
[away, home]. Cada participante tiene id, longName, shortName, homeAway, mainPitcher, rotationNumber, futuresSide.Ejemplo
{
"data": {
"games": [
{
"id": "6266c12172aefcf0033374ce",
"parentGameID": null,
"cheapDataUID": "32620-79238-2022-04-26",
"league": "NHL",
"sport": "hockey",
"start": "2022-04-26T18:00:00.000Z",
"ended": false,
"live": false,
"featured": false,
"participants": [
{ "id": "60747bc471b5071a80ca0ac8", "longName": "Carolina Hurricanes", "shortName": "CAR", "homeAway": "away", "mainPitcher": null, "rotationNumber": "25", "futuresSide": "" },
{ "id": "607349daf6d3364eb69604f6", "longName": "New York Rangers", "shortName": "NEW", "homeAway": "home", "mainPitcher": null, "rotationNumber": "26", "futuresSide": "" }
]
}
]
}
}
Errores
| Estado | Significado |
|---|---|
400 | league es obligatorio. |
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
League code from GET /exchange/getLeagues. Use upcoming for all upcoming games across leagues.
Optional sport filter.
Respuesta
Games list
Show child attributes
Show child attributes
¿Esta página le ayudó?