Competition

Table of Contents

Competition

What is Competition? A competition is representation of a real-life Competition like the “Premier league” in the UK. It defines some Competition specific rules which are then applied to every Fixture, Round, Season associated with the same Competition.

A Competition can be proposed through the Fixtures API v2 on endpoint /v2/competitions

A Competition will be considered as duplicate when all of the properties Name and GSS Sport Id match any of the already existing Competitions in the GSS system.

A Competition will be considered as friendly Competition when metadatProperty with name IsFriendly with value yes is set.


A Competition name must end with gender info in it due to legacy GSS and clients reasons. E.g.
For male competitions no gender info must be included: Champions League

For female competitions the name must end with Women: Champions League Women

For Mixed or Undefined gender the name must end with Mixed: Champions League Mixed

A Competition can be requested through the Fixture API v2 on endpoint /v2/competitions.

When to use

The Competition is used to sum multiple Season entities under one entity.

How to use

The Competition entity can be used to define rules and properties of a Competition which are repeated from one Season to another. E.g. The “Premier League” is a Competition which is male only, and is played with the 90 minutes rule without additional time regardless the specific Season. The Competition entity can be retrieved from the Fixtures API v2 on endpoint /v2/competitions. 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 Competition from Fixtures API v2

    curl --location --request GET 'https://ci.fixtures.api.geniussports.com/v2/competitions' \ --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": [ // Array of sport specific rules { "name": "string", "value": "string" } ], "sport": { "Id": 0, // The GSS Sport Id which will define what players can be part of the competition related seasons,rounds and fixtures "Name": "string", "ref": "/sports/{id}" // Endpoint on which Sport is available }, "locality": { "Id": 0, "Name": "string", "ref": "/localities/{id}" // Endpoint on which the Locality is available }, "id": 0, // The GSS Competition Id "name": "string", "createdOn": "2021-11-29T11:40:11.154Z", "modifiedOn": "2021-11-29T11:40:11.154Z", "updatesCount": 0, "genderType": "string", // The gender which defines the gender of the competitor types which can take part in the competition related season, rounds and fixtures "shortName": "string", // The short name of the Competition "longName": "string", // The long name of the Competition "sponsorName": "string", // The name of the sponsor of the Competition "youth": "bool", // Indicate is youth competition or not "organization": { "id": 0, // GSS Organization Id "name": "string", // GSS Organization name "ref": "/organization/{id}" // Endpoint on which the Organization is available }, "timezone": { "id": 0, "name": "string", "ref": "string" } } ], "self": "string", "previous": "string", "next": "string", "first": "string", "last": "string" }

     

  2. POST Season for any of the retrieved GSS Competition Ids:

    curl --location --request POST '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 '{ "startDate": "2021-03-17T13:29:32.585Z", "endDate": "2022-03-17T13:29:32.585Z", "competitionId": 0 // GSS Competition Id from the previous request }'

Read Data Points

Field

Type

Nullable

Description

Field

Type

Nullable

Description

id

int64|unsigned

The numeric identifier of the Competition in GSS

name

string

The name of the Competition (e.g. Premier League)

longName

string

The long name of the Competition (e.g. The Football Association Premier League Limited)

shortName

string

The short name of the Competition (e.g. Premier League)

sponsorName

string

The name of the sponsor of the Competition (e.g. Barclays)

youth

bool

Indicate is youth competition or not. Default value: false

genderType

string|in: undefined, male, female, mixed

Restricts the Competition to contain only Fixtures, Rounds, Seasons and Competitors for the specific Gender.

sport

object|SportEmbed

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

organization

object|OrganizationEmbed

The numeric identifier, name and a reference of the Organization which is on top of the Competition (e.g. English Football League)

locality

object|LocalityEmbed

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

timezone

object|TimezoneEmbed

The timezone where the Competition 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 Competition in GSS

name

string

The name of the Competition (e.g. Premier League)

longName

string

The long name of the Competition (e.g. The Football Association Premier League Limited)

shortName

string

The short name of the Competition (e.g. Premier League)

sponsorName

string

The name of the sponsor of the Competition (e.g. Barclays)

youth

bool

Indicate is youth competition or not. Default value: false

genderType

int32|in: 0, 1, 2, 3

0 - Undefined; 1 - Male; 2 - Female; 3 - Mixed

sportId

int64|unsigned

The GSS Sport Id for which is the Competition

organizationId

int64|unsigned

The GSS Organization Id of the Competition. Once set it cannot be changed.

localityId

int64|unsigned

The Locality Id of the competition

timezone

string

The Timezone name where the Competition will be held

metadataProperties

array|MetadataEmbed

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

Competition must exist

400

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

Competition must not exist

409

Conflict detected! Competition with name {proposed name} already exists. Check if the competition you propose is the same as the one already existing in the database under id {existing competition id}. If it is you can update it, if not you should think of another name!

Locality must exist

400

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

Organization must exist

400

Not found. Missing Organization entity with id: {proposed organization id}

Sport must exist

400

Not found. Missing Sport entity with id: {proposed sport id}

Timezone must exist

400

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

Name must end with ‘Women’ when the genderType property is set to Women (2). Legacy Reasons

400

Competition name must have gender info postfix. Possible postfixes by gender: When gender is Male - Do not place postfix; When gender is Female - Women; When gender is Undefined or Mixed - Mixed

Name must end with ‘Mixed’ when the genderType property is set to Undefined (0), Mixed (3). Legacy Reasons

400

Competition name must have gender info postfix. Possible postfixes by gender: When gender is Male - Do not place postfix; When gender is Female - Women; When gender is Undefined or Mixed - Mixed

Organization must not be changed once set

400

Once set competition's organization cannot be changed!

Seasons must not be attached to the Competition

400

Only competitions without associated seasons can be deleted!