I am struggling to work out if there is a way to use an API key when trying to call data from an endpoint and if so, where would I put it?
var request = new XMLHttpRequest("Ocp-Apim-Subscription-Key: {KEY}")
// Open a new connection, using the GET request on the URL endpoint
request.open('GET', 'https://api.sportsdata.io/v3/mlb/scores/json/AreAnyGamesInProgress')
request.onload = function () {
// Begin accessing JSON data here
}
// Send request
request.send()