Head to head
Retrieve the last ten head to head games between two teams.
- Pagination
- Not paginated
Specify teamIdOne and teamIdTwo, both from
teams.
The order does not matter, so you do not need to work out which side is
at home before calling.
Use it to compare two teams on their past results, which is the usual companion to a game preview. For each team's recent form independent of the opponent, use last five games.
Parameters
| Parameter | Type | Description |
|---|---|---|
teamIdOnerequired
|
number |
No description in the spec.e.g. 10291175
|
teamIdTworequired
|
number |
No description in the spec.e.g. 10291176
|
Request
curl --request GET \
--url 'https://baseball.highlightly.net/head-2-head?teamIdOne=10291175&teamIdTwo=10291176' \
--header 'x-rapidapi-key: YOUR_API_KEY'
const params = new URLSearchParams({
teamIdOne: '10291175',
teamIdTwo: '10291176'
})
const response = await fetch(`https://baseball.highlightly.net/head-2-head?${params}`, {
headers: {
'x-rapidapi-key': process.env.HIGHLIGHTLY_API_KEY
}
})
if (!response.ok) {
throw new Error(`Highlightly responded ${response.status}`)
}
const data = await response.json()
import os
import requests
response = requests.get(
'https://baseball.highlightly.net/head-2-head',
params={
'teamIdOne': '10291175',
'teamIdTwo': '10291176',
},
headers={
'x-rapidapi-key': os.environ['HIGHLIGHTLY_API_KEY'],
},
timeout=10,
)
response.raise_for_status()
data = response.json()
Response
idnumberrequired
roundstringrequired
datestringrequired
leaguestringrequired
seasonnumberrequired
awayTeamBaseballMatchTeamResponserequired5 fields
idnumberrequired
logostring
namestring
displayNamestringrequired
abbreviationstringrequired
homeTeamBaseballMatchTeamResponserequired5 fields
idnumberrequired
logostring
namestring
displayNamestringrequired
abbreviationstringrequired
stateBaseballMatchStateResponserequired12 fields
descriptionstringrequiredFinishedPostponedPeriod EndRain DelayScheduledHalf TimeIn ProgressCanceledUnknownSuspendedAbandoned
reportstringAdditional description of the match state.
scoreBaseballMatchScoreResponserequired9 fields
homeBaseballMatchScorerequired3 fields
hitsnumber
errorsnumber
inningsstring[]requiredScores for each played inning.
awayBaseballMatchScorerequired3 fields
hitsnumber
errorsnumber
inningsstring[]requiredScores for each played inning.
currentstring
Example response
[
{
"id": 394,
"round": "regular-season",
"date": "2024-03-06T00:30:00.000Z",
"league": "NCAA",
"season": 2024,
"awayTeam": {
"id": 219,
"logo": "https://example.com/logos/team/219.png",
"name": "Bears",
"displayName": "Baylor",
"abbreviation": "BAY"
},
"homeTeam": {
"id": 219,
"logo": "https://example.com/logos/team/219.png",
"name": "Bears",
"displayName": "Baylor",
"abbreviation": "BAY"
},
"state": {
"description": "Finished",
"report": "Final",
"score": {
"home": {
"hits": 4,
"errors": 2,
"innings": [
0,
0,
1,
1,
0,
0,
1,
1,
1
]
},
"away": {
"hits": 4,
"errors": 2,
"innings": [
0,
0,
1,
1,
0,
0,
1,
1,
1
]
},
"current": "5 - 8"
}
}
}
]
Values are the examples declared in the OpenAPI spec, not a captured live response.
Errors
| Status | Description |
|---|---|
400 |
Bad request descriptive error. |
500 |
Internal server error. |