Make your first request
Now that all prerequisites have been fulfilled, weโre ready to send our first request to the API!
Last updated
Was this helpful?
Now that all prerequisites have been fulfilled, weโre ready to send our first request to the API!
Last updated
Was this helpful?
The request consists of the following components:
The base URL
A path parameter, in this example, we use fixtures
Optional: Query string parameters, to filter on enrich your requests.
And finally, your API token
In this example we're using the . The base URL of the fixtures endpoint is:
We offer two different options for passing your API token. You are free to choose between the authentication methods. You can also use both of them at the same time. Please note that both methods count towards the same
Authenticate using a query parameter:
You can pass your API token by passing 'api_token' in your request parameters, like so:
https://api.sportmonks.com/v3/football?api_token=YOUR_TOKEN
Authenticate using a request header: You can also pass your token via an 'Authorization' header, like so:
Authorization
For example, this can results in the below request and response:
The example above was the most basic request you can create, while our highly flexible football API 3.0 can handle way more advanced requests. Our API's data will enable you to create excellent and specialized applications.
You are getting the hang of it now. Letโs make one more request with multiple includes.
&select=
Select specific fields on the base entity
&select=name
&include=
Include relations
&include=lineups
&filters=
Filter your request
&filters=eventTypes:15
;
Mark end of (nested) relation. You can start including other relations from here
&include=lineups;events;participants
:
Mark field selection
&include=lineups:player_name;events:player_name,related_player_name,minute
,
Used as separation to select or filter on more ids
&include=events:player_name,related_player_name,minute&filters=eventTypes:15
For example, you want the scores, teams and events of a certain fixture. In this case, you would use scores;participants;events
One of our new additions to API 3.0 is a name field on the fixtures. The name field contains a textual representation of the participants playing the fixture. Without selecting a specific field, the API request and response would look like this:
As you can see, the API response is rather large if you're only interested in the fixture's name. Let's select that API field to reduce the response length and size.
In our example, this would result in the below API request and response:
As you can see in the example response above, the 'name' field is only returned for the fixture.
Next to selecting specific fields on the base entity or includes, itโs possible to filter your request.
Letโs say you want to request all the events of a specific fixture, like Celtic vs Rangers. Your request would look like this:
As you can see in the response, you will receive all match events. But what if youโre only interested in a specific event like goals, cards or substitutions? You can filter on the specific data you're interested in:
Alright, we have now discussed a lot of important information about the API and how to make requests to the โAll fixturesโ endpoint. Let's continue with how to set your timezone.
Letโs make another request, and add an include to get more information. The includes can be found on the specific endpoint page. In our case, .
Great, now you have used the first part of API 3.0โs A quick overview of the new syntax:
We're using the . This means we can select on all the fields of the You can do this by adding &select=
{specific fields on the base }.
There are a lot more variations available. More information about your options to enrich your request can be found in our section.