Skip to content

XXXCreate Competitors

This section will tell you how to add competitors to your competition.

Competitors must be identified by a unique string, competitor_id, which is often the bib number on their chest. It must be unique within the competition, but need not be globally. However, if exporting from another system, you may wish to use your internal ID for that athlete.

For the purposes of results upload, there is no need to specify "who entered what" in advance; if we see bib 100 in the results, we'll just assume it matches the competitor with competitor_id="100". However, if you wanted to upload entry and start lists pre-competition, you'd want to "drill into" the events_entered property of each competitor, to tell us who is doing which events.

JSON field Structure

  • competitor_id = The bib of the athlete.
  • For now age_group and category generally do not need to be submitted, as they will be calculated depending on the date of birth. We use World Athletics-style age groups: U14, U16, U18 etc.
  • team_id = OpenTrack short code representing an organisation the athlete represents, a team, club or a country.
  • gender = M/F/X. (The latter meaning "I would rather not specify". 'X' competitors will be fetched into Men's' start lists.)
  • first_name, last_name are self-explanatory.
  • first_name_local, last_name_local are the equivalent when using dual scripts, such as Greek or Russian; we will attempt to display the viewer's preferred script from their browser settings.
  • events_entered.event_code = The code used in the events grid to identify the event, e.g. HJ = High Jump, we have rules on choosing these you can find here.
  • events_entered.event_id = Numerical identify of event in our system, should not clash with any other event_id. events can simply be numbered 1, 2, 3... etc.

Structure of added field:

"competitors": [
    {
        "age_group": "NA", 
        "category": "NA",
        "competitor_id": "371", 
        "date_of_birth": "1966-03-21",
        "events_entered": [
            {
                "event_code": "PV", 
                "event_id": "F2"
            }
        ], 
        "first_name": "Andrew",
        "gender": "M", 
        "last_name": "Robinson", 
        "nationality": "GBR",
        "team_id": "THH"
    },
]

Implemented Example

We can see here what it looks like with a competitors field added at the bottom.

{
    "full_name": "api-test competitors",
    "short_name": "api-test",
    "slug": "api-test-slug-3",
    "name_local": "api-test",
    "country_id": "GBR",
    "address": "Kingsmeadow, Jack Goodchild Way, Kingston Road, Kingston upon Thames, UK",
    "date": "2020-08-10",
    "finish_date": "2020-08-15",
    "wa_rankings_category_id": "DF",
    "age_groups": ["ALL"],
    "basic_description": "This is an opentrack api test",
    "contact_details": "example@example.com",
    "organiser_id": "6b2af700-0481-4f73-b9ae-8221ae619b55",
    "website": "https://example.example",
    "entry_link": "https://example.example/entry",
    "results_link": "https://example.example/results",
    "competitors": [
        {
            "age_group": "NA", 
            "category": "NA",
            "competitor_id": "371", 
            "date_of_birth": "1966-03-21",
            "events_entered": [
                {
                    "event_code": "PV", 
                    "event_id": "F2"
                }
            ], 
            "first_name": "Andrew",
            "gender": "M", 
            "last_name": "Robinson", 
            "nationality": "GBR",
            "ot_athlete_id": "44721dcd-3019-44f0-aab0-4b90eb98838d", 
            "team_id": "THH"
        },
        {
            "age_group": "NA", 
            "category": "NA",
            "competitor_id": "302", 
            "date_of_birth": "1989-04-26",
            "events_entered": [
                {
                    "event_code": "PV", 
                    "event_id": "1"
                }
            ], 
            "first_name": "Gus",
            "gender": "M", 
            "last_name": "Upton", 
            "nationality": "GBR",
            "ot_athlete_id": "af0a1892-0c9d-4031-a4cf-690c3c37bc49", 
            "team_id": "BEL"
        }
    ]
}

Competitors can be created like this beforehand, before we create events. However it is important to make sure that the event_id and event_code match correctly when you do get down to defining events so it may help to have these written out in advance.

The following example shows the result of uploading the above JSON. The screenshots used in the events also include competitors in them which is why they have all the athlete information filled in.

Method

A code example can be found at https://github.com/openath/opentrack-api-examples/blob/main/results_upload/api_create_competitors.py.

The only change to be made to make this example runnable is to replace the EMAIL and PASSWORD string with your OpenTrack email and password that has authorisation to create competitions.