Season

Table of Contents

Season

What is Season? A Season is representation of a real life Competition like the “Premier league 2021/2022” in the UK. It defines some season specific rules which are then applied to every Fixture and Round associated with the same Season. The difference between Season and Competition is that the Competition is not recreated every year while the Season is. E.g. We have one Competition “Premier League” with many Seasons in format “Premier League YYYY-From/YYYY-To“. The name of the Season is auto generated from the Competition name + if the start and end year of the Season are the same then YYYY; else YYYY-From/YYYY-To (“Roland Garros 2021“ or “Premier League 2021/2022“).

A Season can be proposed through the Fixtures API v2 on endpoint /v2/seasons

A Season will be considered as duplicate when all of the properties GSS Competition Id, Season Start Year and Season End Year match any of the already existing Seasons inside the GSS Competition in the GSS system.


In order to use Competitor in any of the Fixtures or Rounds related to the created Season you will have to add SeasonCompetitors through the competitors property of the object which is going to be sent on create or update!

A Season can be requested through the Fixture API v2 on endpoint /v2/seasons.

When to use

The Season entity is used to define Sport specific rules if any to all Fixtures associated with it for the current real-life Season. It can also be used to get Fixtures, Rounds and Competitors which took part of it for statistical purposes.

How to use

The Season entity can be used to define rules and properties of Fixtures to which will be applied through out the whole Season but may or may not be applied the next one. It also combines all Fixtures under one entity. The Season entity can be retrieved from the Fixtures API v2 on endpoint /v2/seasons. And then set the needed GSS Id to the request which is going to be made to Fixtures API v2 when it is needed.

Example workflow

  1. GET GSS Seasons from Fixtures API v2

    curl --location --request GET 'https://ci.fixtures.api.geniussports.com/v2/seasons' \ --header 'x-api-key: <<api_key>>' \ --header 'Content-Type: application/json' \ --header 'Authorization: <<id_token>>' \ --data-raw ''

    Successful response would be with status code 200 and JSON data in format:

    {   "page": 0,   "pageSize": 0,   "totalItems": 0,   "items": [     {       "metadataProperties": [ // Sport specific rules which will be applied to all fixtures associated with the season         {           "name": "string",           "value": "string"         }       ],       "id": 0, // GSS Season Id       "createdOn": "2021-11-29T11:49:39.406Z",       "modifiedOn": "2021-11-29T11:49:39.406Z", "updatesCount": 0,       "name": "string",       "competition": {         "Id": 0, // GSS Competition Id associated with the Season         "Name": "string",         "Ref": "/competitions/{Id}"       },       "startDate": "2021-11-29T11:49:39.406Z",       "endDate": "2021-11-29T11:49:39.406Z",       "locality": {         "Id": 0,// The locality where the season will take place         "Name": "string",        "ref": "/localities/{id}" // Endpoint on which the Locality is available       },       "timezone": {         "Id": 0, // The GSS Timezone Id         "Name": "string",         "Ref": "/timezones/{Id}",       },       "genderType": "string", // The gender of the season (defines what competitors can be added to it (e.g. season with gendertype Male cannot include teams with gender type Female)       "sport": {         "Id": 0, // GSS Sport ID Defines what competitors can be added to the current season and later on to the Round or to the Fixture         "Name": "string",         "ref": "/sports/{id}" // Endpoint on which Sport is available       }     }   ],   "self": "string",   "previous": "string",   "next": "string",   "first": "string",   "last": "string" }
  2. POST Round for any of the retrieved GSS Season Ids:

    curl --location --request POST 'https://ci.fixtures.api.geniussports.com/v2/rounds' \ --header 'x-api-key: <<api_key>>' \ --header 'Content-Type: application/json' \ --header 'Authorization: <<id_token>>' \ --data-raw '{   "type": "0",   "seasonId": 0, // The GSS Season Id from the previous request   "name": "string",   "startdate": "2020-12-10T08:13:54.898Z",   "enddate": "2020-12-12T08:13:54.898Z" }'

Read Data Points

Field

Type

Nullable

Description

Field

Type

Nullable

Description

id

int64|unsigned

The numeric identifier of the Season in GSS

name

string

The name of the Season (e.g. 2022/2023 Premier League). This property is read-only and is auto-filled by the associated Competition Name and the Associated Start and End dates as described here: Season | Season

genderType

string|in: undefined, male, female, mixed

Restricts the Season to contain only Fixtures, Rounds and Competitors for the specific Gender. This property is read-only and is auto-filled by the associated Competition

startDate

timestamp

The date on which the Season starts

endDate

timestamp

The date on which the Season ends

sport

object|SportEmbed

The numeric identifier, name and a reference of the Sport for which is the Season. This property is read-only and is auto-filled by the associated Competition

competition

object|CompetitionEmbed

The numeric identifier, name and a reference of the Competition for which is the Season

locality

object|LocalityEmbed

The id, name and reference of the Locality where the Season will be held

timezone

object|TimezoneEmbed

The timezone where the Season will be held

metadataProperties

array|MetadataEmbed

Check AllowedMetadataPropertyType

createdOn

timestamp

The timestamp when the data entity was created

modifiedOn

timestamp

The timestamp when the data entity was modified

updatesCount

int32|unsigned

The amount of times the data entity was updated

Create/ Update Data Points

Field

Type

Required On Create

Required On Update

Description

Field

Type

Required On Create

Required On Update

Description

id

int64|unsigned

The numeric identifier of the Season in GSS

startDate

string

The date on which the Season starts

endDate

string

The date on which the Season ends

competitionId

int64|unsigned

The GSS Competition Id for which is the Season

localityId

int64|unsigned

The GSS Locality Id of the Season.

timezone

int64|unsigned

The Timezone name where the Season will be held

competitiors

array|int64|unsigned

The GSS Competitor Ids which will take part in the Season

metadataProperties

string

Check AllowedMetadataPropertyType

 

Validations

Description

On Create

On Update

On Delete

Response Code

Contains Conflict Header

Error Message

Description

On Create

On Update

On Delete

Response Code

Contains Conflict Header

Error Message

Season must exist

400

Not found. Missing Season entity with id: {proposed id}

Season must not exist

409

Conflict detected! Duplicate season exists with id {existing season id}. Keep in mind that you cannot duplicate seasons. If you want to create new season choose different start and end date. If you want to update it use the update endpoint with different date for the existing season!

Locality must exist

400

Not found. Missing Locality entity with id: {proposed locality id}

Competition must exist

400

Not found. Missing Competition entity with id: {proposed competition id}

Timezone must exist

400

Not found. Timezone with name {proposed timezone} does not exists.

All competitors must exist

400

Only existing competitors are allowed to be added to season. Competitors which do not exist are: {competitors ids separated by ', '}

All competitors must be active

400

Only competitors with status type Active are allowed to be added to season. Competitors which do not have status type Active: {competitor ids separated by ', '}

All competitors must be for the same gender as the season

400

Only competitors with gender same as season's competition gender are allowed to be added to season with competition's gender {gender of the competition associated with the season}. Competitors which do not have the same gender as the season's competition: {competitor ids separated by ', '}

Only distinct competitors can be sent

400

Duplicated competitors: {competitor ids separated by ', '}

Competitors must be for the same sport

400

Only competitors from the same sport as the season's competition are allowed to be added to the season. Season's competitionId {proposed competition id} and season's competition's sportId {proposed competition’s sport id}. Competitors which have different sports: {competitor ids separated by ', '}

Only competitors which do not have fixtures for the season can be removed

400

Competitors with ids {competitor ids separated by ', '} were not proposed in season {season id} update request which means they are going to be deleted. However, you cannot delete them because the mentioned competitors already have fixtures associated with this season!

Rounds are not associated with the Season

400

Only seasons without associated rounds can be deleted!

Proposed startDate must be before the proposed endDate

400

Start date must be before end date!