AllowedMetadataPropertyType

Table of Contents

AllowedMetadataPropertyType

What Is AllowedMetadataPropertyType? The AllowedMetadataPropertyType is the entity which defines the specific rules which can be set to different Sports because each sport has its own sport specific rules. E.g. PeriodDuration which can be set on Fixtures for Sport Football but cannot be set to Tennis and vice-versa for MetadataPropertyType Sets. Each sport can have multiple AllowedMetadataPropertyType. And they have also relations to entity type because different entities can have different MetadataPropertyType. E.g. For Competitor for Sport Football it can have MetadataPropertyType ShirtNumber and for the Fixture it cannot have this same property and vice-versa for MetadataPropertyType PeriodDuration. Each Entity can have multiple types based on the Sport.

When to use

The AllowedMetadataPropertyType can be used to check which properties can be set as value on the metadataProperty data point on each entity which has it for the sport to which the entity will be associated

How to use

You can request the metadataProperties for specific entity for specific sport on Fixtures API v2 on endpoint /v2/sports/{id}/{entityType}/metadata.

Due to the fact that for some property types only a list of values is allowed and on others you can set any value you want, The metadata property type will contain a field allowNonPredefinedValues which is either True or False and states whether a free value is allowed or a value from the list will be needed.

Example workflow

  1. GET AllowedMetadataPropertyTypes for specific entity for specific sport

    curl --location --request GET 'https://ci.fixtures.api.geniussports.com/v2/sports/<<gss_sport_id>>/<<entityType>>/metadata' \ --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:

    [ { "id": 0, // Id of the AllowedMetadataPropertyType "name": "string", // Name of the allowed metadata property type "allowNonPredefinedValues": true, // Whether the value for the property type can be any value or only values from the `values` array can be used "isRequired": true, // Whether the value type and value must be included in the proposed `entityType` "values": [ // comma separated values which can be used as value for the property type when `allowNonPredefinedValues` is set to false "string" ] } ]

     

  2. POST entityType with any of the received AllowedMetadataPropertyTypes

    curl --location --request POST 'https://ci.fixtures.api.geniussports.com/v2/<<entityType>>' \ --header 'x-api-key: <<api_key>>' \ --header 'Content-Type: application/json' \ --header 'Authorization: <<id_token>>' \ --data-raw '{ ... // entity specific properties "metadataProperties":[ { "name": <<any of the `name`s received from the request from step 1>>, "value": <<based on `allowNonPredefinedValues` property from request from step 1 for the chosen property type either any value or any value from the `values` property>> } ] } '

     

     

Important

Available entityTypes to query metadata for them:

Use the names in place of the {entityType} parameter as described here.

The values are replicated from top of the hierarchy to the bottom of it (Competition Property → Round Property → Fixture Property) when value is set on higher level and not set on lower level. E.g.
If PeriodDuration is set to Competition level with value 90 all lower level entities (Round, Fixture) will have the same value unless they override the property value.

If a higher level property is changed all future lower level entities' properties will be updated as well to the new value. E.g.: If today’s date is 20.02.2020 and there is Fixture for 19.02.2020 and another for 21.02.2020 and they have the same Competition and the Competition’s property PeriodDuration is updated then the only Fixture which will be affected is the one for 21.02.2020, the other one for 19.02.2020 will not be affected as it has already passed and cannot be modified!

Data Points

Field

Type

Description

Field

Type

Description

id

int64|unsigned

The numeric identifier of the AllowedMetadataPropertyType in GSS

name

string

The name of the AllowedMetadataPropertyType which can be used in the metadataProperties data point of the specific entityType for the specific Sport

allowNonPredefinedValues

boolean

Whether the value for the AllowedMetadataPropertyType can be any value or only values from the values array can be used as value for the name in the metadataProperties data point of the specific entityType for the specific Sport

isRequired

boolean

Whether the AllowedMetadataPropertyType must be included in the metadataProperties data point of the specific entityType for the specific Sport

values

array|string

The values which can be used as value for the name in the metadataProperties data point of the specific entityType for the specific Sport when allowNonPredefinedValues is set to true