Person

Overview

Ok, so let’s talk about persons. It’s the tiniest resource in some way as it’s mostly other resources that contain persons but whatsoever. A Person resource mostly reflects a football player (79,13% of all persons in my database are players), but there’s also referee’s or staff members that can be retrieved via the Person resource.

Most likely the matches subresource will be of more interest as you can filter matches on attributes of that very player.

But first things first, see the entire beauty of the Person resource below.

curl -XGET 'https://api.football-data.org/v4/persons/16275' -H "X-Auth-Token: UR_TOKEN"
{
    "id": 16275,
    "name": "Djibril Sow",
    "firstName": "Djibril",
    "lastName": "Sow",
    "dateOfBirth": "1997-02-06",
    "nationality": "Switzerland",
    "position": "Central Midfield",
    "shirtNumber": 8,
    "lastUpdated": "2022-03-17T16:47:43Z",
    "currentTeam": {
        "area": {
            "id": 2088,
            "name": "Germany",
            "code": "DEU",
            "flag": "https://crests.football-data.org/759.svg"
        },
        "id": 19,
        "name": "Eintracht Frankfurt",
        "shortName": "Frankfurt",
        "tla": "SGE",
        "crest": "https://crests.football-data.org/19.svg",
        "address": "Mörfelder Landstraße 362 Frankfurt am Main 60528",
        "website": "http://www.eintracht.de",
        "founded": 1899,
        "clubColors": "Red / Black",
        "venue": "Deutsche Bank Park",
        "runningCompetitions": [
            {
                "id": 2002,
                "name": "Bundesliga",
                "code": "BL1",
                "type": "LEAGUE",
                "emblem": "https://crests.football-data.org/BL1.png"
            },
            {
                "id": 2011,
                "name": "DFB-Pokal",
                "code": "DFB",
                "type": "CUP",
                "emblem": "https://crests.football-data.org/DFB_CUP.png"
            },
            {
                "id": 2146,
                "name": "UEFA Europa League",
                "code": "EL",
                "type": "CUP",
                "emblem": "https://crests.football-data.org/EL.png"
            }
        ],
        "contract": {
            "start": "2019-07",
            "until": "2024-06"
        }
    }
}

Looks reasonable. You now know the players name and some more personal details except for his haircut. You can see what competitions his team participates this season, and how long he’s planning to play for that club.

You want to see all the matches he played this season? I was expecting that.

Matches

You use the Matches Subresource to fetch a list of matches that are pre-filtered by that very person.

{
    "filters": {
        "limit": 15,
        "offset": 0,
        "competitions": "BL1,DFB,EL",
        "permission": "TIER_THREE"
    },
    "resultSet": {
        "count": 15,
        "competitions": "BL1,EL",
        "first": "2022-02-19",
        "last": "2022-05-14"
    },
    "aggregations": {
        "matchesOnPitch": 15,
        "startingXI": 12,
        "minutesPlayed": 1086,
        "goals": 0,
        "ownGoals": 0,
        "assists": 1,
        "penalties": 0,
        "subbedOut": 3,
        "subbedIn": 0,
        "yellowCards": 3,
        "yellowRedCards": 0,
        "redCards": 0
    },
    "person": {
        "id": 16275,
        "name": "Djibril Sow",
        "firstName": "Djibril",
        "lastName": "Sow",
        "dateOfBirth": "1997-02-06",
        "nationality": "Switzerland",
        "position": "Midfield",
        "shirtNumber": null,
        "lastUpdated": "2022-03-17T16:47:43Z"
    },
    "matches": [ ... ]
}

You see the applied filters on the very top: by default this is a match limit of 15. The competitions and permission attributes are mostly for debugging purposes. It’s followed by the resultSet node which gives information on the boundaries of the match list at the very bottom and some basic aggregation data. Last but not least you find an aggregate node that holds aggregated information of the matches returned. Last but not least the list of match items follows.

Let’s play around a bit with the interface.

curl -XGET 'https://api.football-data.org/v4/persons/16275/matches' -H 'X-Auth-Token: UR_TOKEN'

No query parameters. The resource responds with this seasons' matches of that very player in descending order. Click here to see them with some layers of plumbing and transformation code in between.

Okay some more. Give me…​

…​the last 10 matches he failed and was pulled out to bench:

curl -XGET 'https://api.football-data.org/v4/persons/16275/matches?e=SUB_OUT&limit=10' -H 'X-Auth-Token: UR_TOKEN'

…​the last 3 matches where he shined and scored:

curl -XGET 'https://api.football-data.org/v4/persons/16275/matches?e=GOAL&limit=5' -H 'X-Auth-Token: UR_TOKEN'

Okay I hope you got it. See all possible query parameters for the Subresource within the table below:

Filters

Attribute name Possible values

lineup

STARTING | BENCH

e

GOAL | ASSIST | SUB_IN | SUB_OUT

dateFrom

/?dateFrom=2022-01-01

dateTo

/?dateTo=2022-01-10

competitions

/?competitions=PL,FAC

limit

Integer [1-100]

offset

Integer [1-100]