Organization

Table of Content

Organization

What is Organization? An Organization is representation of a real-life organization like the “NCAA” in the USA. It groups multiple Competitions within multiple Sports.

All Organizations must have unique Name and Code

When to use

The Organization is used when multiple Competitions under different sports have to be grouped.

How to use

The Organization entity can be retrieved and proposed on the Fixtures API v2 on endpoint /v2/organizations. Once retrieved a GSS Organization Id then it can be set to the request which is going to be made to Fixtures API v2 when it is needed.

Example workflow

  1. GET GSS Organization from Fixtures API v2

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

    The successful response would be with status code 200 and JSON data in the format:

    { "page": 0, "pageSize": 0, "totalItems": 0, "items": [ { "id": 0, // GSS Organization Id "createdOn": "2022-06-23T12:43:28.120Z", // When was the Organization created "modifiedOn": "2022-06-23T12:43:28.120Z", // When was the Organization last modified "updatesCount": 0, // How many times was the Organization modified "name": "string", // The name of the Organization "code": "string" // The code of the Organization } ], "self": "string", "previous": "string", "next": "string", "first": "string", "last": "string" }

     

  2. POST Competition with any of the retrieved GSS Organization Ids:

    curl --location --request POST '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 '{ "sportId": 10, // This could be any GSS Sport Id "organizationId": 15, // this could be any GSS Organization Id "localityId": 3795038, "genderType": "1", "name": "Some Competition Name" }'

Read Data Points

Field

Type

Nullable

Description

Field

Type

Nullable

Description

id

int64|unsigned

The numeric identifier of the Organization in GSS

name

string

The name of the Organization (e.g. National Collegiate Athletic Association)

code

string

The unique short code of the Organization (e.g. NCAA)

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 Organization in GSS

name

string

The name of the Organization (e.g. National Collegiate Athletic Association)

code

string

The unique short code of the Organization (e.g. NCAA)

 

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

Code must be unique

409

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

Name must be unique

409

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

Organization must exist

400

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

No competitions should be attached

400

Organization with id {proposed id} cannot be deleted because the following competitions are attached to it: {GS competitor ids separated by ', '}!