Person
Table Of Contents
Person
What is a Person? Person is a representation of a real-life person which can be used in specific context:
For Competitors of type Player it is the person behind the player.
For Competitors of type Team it is part of their squad, or is the coach, or the owner.
For Competitors of type Doubles Partnership it is the persons behind the Doubles Partnership or their coach.
For Competitors of type Dog and Horse it is the trainer, the owner or the breeder.
- For Competitors of type Horses it could also be its JockeyFor FixtureOfficials either Official Referee or Assistant Referee
Person relation with Competitors of different types is called Contract for simplicity
A Person will be considered duplicate when all of the following is the same: FirstName, LastName, DateOfBirth, GSS Locality Id, GenderType and NickName
When to use
The Person entity is needed in cases when you want to add Person to the Squad of the Team Competitor or when you want to create a Player for specific sport.
How to use
The Person entity can be used by getting its GSS Id from the Fixtures API v2 on endpoint /v2/persons
. And then set the received GSS Id to the request which is going to be made to Fixtures API v2 when it is needed.
Example workflow
GET GSS Persons from Fixtures API v2
curl --location --request GET 'https://ci.fixtures.api.geniussports.com/v2/persons' \ --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, // The GSS Id of the person "fullName": "string", // The Full Name of the Person (combination between FirstName + ' ' + LastName) "firstName": "string", // The First Name of the Person "lastName": "string", // The Last Name of the Person "genderType": "string", // The Gender of the Person Defines in which Teams it can take part and the Gender of the real-life person "dateOfBirth": "2022-06-23T10:34:52.745Z", // The Date of birth of the Person (if available) "isActive": true, // Whether the Person can be used in Contracts or in Fixture Officials "nickName": "string", // The Nickname of the Person (if available) "useNickname": true, // Whether the Person will be displayed with its Nickname when used in Players/Doubles Partnership names "locality": { "id": 0, // The GSS Id of the Country from where the Person comes from, aka Nationality of the Person "name": "string", "ref": "/localities/{id}" // Endpoint on which the Locality is available }, "sports": [ { "id": 0, // The GSS Ids of the sports in which the Person can be used for Contracts or for FixtureOfficials "name": "string", "ref": "/sports/{id}" // Endpoint on which Sport is available } ], "createdOn": "2022-06-23T10:34:52.745Z", // When was the Person created "modifiedOn": "2022-06-23T10:34:52.745Z", // When was the Person last updated "updatesCount": 0 // How many times the Person changed } ], "self": "string", "previous": "string", "next": "string", "first": "string", "last": "string" }
POST Fixture Official with any of the received GSS Person Ids
curl --location --request POST 'https://ci.fixtures.api.geniussports.com/v2/fixtures/{gssFixtureId}/officials' \ --header 'x-api-key: <<api_key>>' \ --header 'Content-Type: application/json' \ --header 'Authorization: <<id_token>>' \ --data-raw '{ "personId": 0, // GSS Person Id "personRole": 0 // Whether the Person is Official Referee or Assistant Referee (the 0 is Official Referee) } '
Important
Updating Person’s IsActive property will trigger automatic logic in the following manner:
Person’s IsActive property is set to false → All related Players, Contracts, Doubles (and the related Contracts to the Double), will be marked as IsActive = false or CompetitorStatusType will be set to Retired.
Person’s IsActive property is updated to true → All related Players' CompetitorStatusType will be set to Active, which are from the same Gender as the Person and are related to any of the Sports associated with the Person
Removing Sport from Person will deactivate all Players, Contracts, Doubles (and the related Contracts to the Double), will be marked as IsActive = false and CompetitorStatusType will be set to Retired.
Read Data Points
Field | Type | Nullable | Description |
---|---|---|---|
id | int64|unsigned | The numeric identifier of the entity | |
fullName | string | Combination of FirstName + “ “ + Last Name for easier filtering | |
firstName | string | The first name of the person | |
lastName | string | The last name of the person (may contain more than one names inside) | |
nickname | string |
| The nickname of the person |
useNickname | boolean | Defines whether when included in Player, Contract, Double should be displayed with the Nickname or with the FullName | |
dateOfBirth | timestamp |
| The birth date of the person |
genderType | int32|Enum | 0 - Undefined; 1 - Male; 2 - Female; 3 - Mixed | |
sports | array|SportEmbed | The numeric identifier, name and a reference of the Sports in which the Person can be used as Player, Contract, Double or Fixture Official | |
locality | object|LocalityEmbed | The id, name and reference of the Nationality of the Person | |
isActive | boolean | Defines whether the Person can be used in Player, Contract, Double or Fixture Official | |
createdOn | timestamp | The timestamp when the data entity was created | |
modifiedOn | timestamp |
| The timestamp when the data entity was last updated |
updatesCount | int32|unsigned | The amount of times the data entity was updated |
Create/ Update Data Points
Field | Type | Required For Create | Required For Update | Description |
---|---|---|---|---|
id | int64|unsigned | The numeric identifier of the entity | ||
firstName | string |
| The first name of the person | |
lastName | string |
| The last name of the person (may contain more than one names inside) | |
nickname | string | The nickname of the person | ||
useNickname | boolean |
| Defines whether when included in Player, Contract, Displayed should be displayed with the Nickname or with the FullName. If this property is set to | |
dateOfBirth | string| format: | The birth date of the person | ||
genderType | int32|in: 0, 1, 2, 3 |
| 0 - Undefined; 1 - Male; 2 - Female; 3 - Mixed | |
sports | array|int64|unsigned |
| The GSS Sport Ids in which the Person can be used as Player, Contract, Double or Fixture Official | |
locality | int64 |
|
| The GSS Locality Id of the Nationality of the Person |
isActive | boolean |
| Defines whether the Person can be used in Player, Contract, Double or Fixture Official |
Validations
Description | On Create | On Update | On Delete | Response Code | Contains Conflict Header | Error Message |
---|---|---|---|---|---|---|
Person must exist |
|
|
| 400 |
| Not found. Missing Person entity with id: {proposed id} |
Person must not exist |
|
|
| 409 |
| Conflict detected! Person with name {proposed firstName + ' ' + lastName}, nickname {proposed nickname}, locality {proposed gs locality id}, gender {proposed gender} and date of birth {proposed date of birth} already exist. Check if the person you propose is the same as the one already existing in the database under id {existing gss person id}. If it is, you can update it, if not you should think of another name or check if any of the values is wrong! |
DateOfBirth is valid string |
|
|
| 400 |
| Person's dateOfBirth is in invalid format! Valid format is: yyyy-MM-dd |
DateOfBirth cannot be in the future |
|
|
| 400 |
| Person's dateOfBirth cannot be in the future! |
Locality must exist |
|
|
| 400 |
| Not found. Missing Locality entity with id: {proposed locality id} |
Nickname must be set when UseNickname is set to true |
|
|
| 400 |
| Nickname property value is not set when useNickname property is set to true! |
Sports must be distinct |
|
|
| 400 |
| Duplicate sport ids! Sport ids must be distinct. |
Sports must have at least one sport |
|
| 400 |
| Person must have at least one sport! | |
All sports must exist |
|
|
| 400 |
| Not found. Missing Person entities with ids: {missing sport ids separated by ', '} |
On Gender change person must not have active contracts! |
|
|
| 400 |
| Person's gender can only be changed if it does not have active competitors associated with it! Associated competitors: {competitor ids separated by ', '}. |
Person must not be associated with any FixtureOfficials, Contracts or Players |
|
|
| 400 |
| Cannot deleted Person {0} because it has associated not deleted competitors and/ or Fixtures! |