I am building a sample app in Rails and trying to use the API sportmonks. I have installed their gemfile and configured my API token in config/environments.
Rails.application.configure do
Sportmonks.configure do |config|
config.api_token = "PzyBgl38lvSgBL5D3mwQbKQ2HfXABJLxmxyrBdzQ1Gt90dSoJ3Jjg3dWRqIN"
end
end
Now, I need to be able to figure out how to use a call link to get JSON, or how to access that. I have been looking for information on this for 2 days and haven’t found anything that points me to the next step.
I would like to be able to use that API data to customize a sports webpage displaying scores and player data, but first I just need to find out how to actually make the request from my app and where everything goes.
The link I’m trying to use as a small sample is to pull the basic data from one league, using the link supplied by the site
https://soccer.sportmonks.com/api/v2.0/leagues/501?api_token=MYTOKENHERE=season,
So, where does that link go? I know it calls to the API and returns a JSON that looks like this
{
"data": {
"id": 501,
"active": true,
"type": "domestic",
"legacy_id": 66,
"country_id": 1161,
"logo_path": "https://cdn.sportmonks.com/images/soccer/leagues/501.png",
"name": "Premiership",
"is_cup": false,
"is_friendly": false,
"current_season_id": 18369,
"current_round_id": 247456,
"current_stage_id": 77453684,
"live_standings": true,
"coverage": {
"predictions": true,
"topscorer_goals": true,
"topscorer_assists": true,
"topscorer_cards": true
},
"season": {
"data": {
"id": 18369,
"name": "2021/2022",
"league_id": 501,
"is_current_season": true,
"current_round_id": 247456,
"current_stage_id": 77453684
}
}
},
"meta": {
"plans": [
{
"name": "Football Free Plan",
"features": "Standard",
"request_limit": "180,60",
"sport": "Soccer"
}
],
"sports": [
{
"id": 1,
"name": "Soccer",
"current": true
}
]
}
}
But I have zero idea of where that would show up on my Rails app, or how to make that request from it.
Any kind of help would be appreciated.