FIFA Connect ID Java SDK, v6.2
The primary responsibility of the FIFA Connect ID Service (FCI) is to generate a unique FIFA_ID for stakeholders involved in football, futsal, and beach soccer. Registration Systems in various Member Associations integrate with FCI to register persons, organisations and facilities in order to obtain FIFA_IDs for these entities.
Integration can be achieved in two ways:
This documentation serves as a reference for developers seeking to integrate Registration Systems with FCI using the SDK.
Chapter 1 provides introductory information on the classes within the SDK, as well as guidance on dates and thread safety.
Chapter 2 covers the basics of integration with FCI, serving as a starting point for further actions.
The following three chapters discuss the management of specific entity types:
Chapter 6 provides information on integration with the Transfer Matching System (TMS), enabling the transmission of data concerning players' first professional registrations, transfers, and committed payments.
Chapter 7 focuses on subscribing to automatic notifications for changes made to entities registered in FCI.
Class names, following the FIFA Data Standard, cannot be modified.
Some SDK classes that represent read-only data provided by the server side (e.g., PersonDuplicateType) contain setter methods. These are included to allow the client to simulate possible responses from the service, which can be useful for testing.
All SDK methods require date and time in the UTC time zone for consistency across different time zones. If the date/time is not in UTC, an Exception is thrown.
Birth dates should not be affected by time zone changes. For example, both persons born in Chile and Japan on 1.1.2012 should be registered as born on 1.1.2012 0:00 UTC.
Note: Birth dates returned from the SDK should represent a date without a time zone (time zone should be disregarded when comparing dates). For example, a birth date of 1.1.2012 0:00 [UTC-3] represents the same birth date as 1.1.2012 0:00 [UTC+9].
Any instance members are not guaranteed to be thread safe. In particular, all methods on FifaConnectServiceBusClient cannot be called from multiple threads simultaneously. If needed, a new instance of FifaConnectServiceBusClient should be created per thread.
Java 11 (or higher) is required.
You can reference either the jar with dependencies embedded or the jar without them. In the latter case, the following dependencies need to be referenced as well:
com.google.guava : guava : 27.1com.squareup.okhttp3 : logging-interceptor : 4.2.2com.squareup.retrofit2 : retrofit : 2.9.0com.fasterxml.jackson.core : jackson-databind : 2.10.1com.fasterxml.jackson.datatype : jackson-datatype-joda : 2.10.1com.microsoft.rest : client-runtime : 1.7.9com.microsoft.azure : msal4j : 1.7.1com.sun.xml.bind : jaxb-core : 2.3.0com.sun.xml.bind : jaxb-impl : 2.3.0javax.xml.bind : jaxb-api : 2.3.0The RegistrationFacade class simplifies the usage of FifaConnectIdClient and FifaConnectServiceBusClient in order to seamlessly start executing actions in FCI.
This chapter goes through needed dependencies when bootstrapping the RegistrationFacade instance.
Instance of type ConnectIdEnvironment provides the information about the service SDK will make request to. It is recommended to use one of environments defined as static properties of the class:
ConnectIdEnvironment connectIdEnvironment = ConnectIdEnvironment.beta;Available pre-defined environments are:
| Environment | Environment code |
|---|---|
| beta | beta |
| preProduction | prep |
| production | prod |
In order to authenticate SDK to the service you have to provide a set of client credentials. Create instance of ClientCredentials using client ID and secret key gained during given environment onboarding process.
ClientCredentials clientCredentials = new ClientCredentials("clientId", "secretKey");In order for the SDK to encrypt outgoing and decrypt incoming data, a pair of public and private certificates must be generated.
Instructions on how to generate and upload certificates can be found in fifa-connectservicebus-certificates-generation.html file in root directory of SDK's *.zip package. Once this is done, the next step is to provide the generated private key to the client.
The easiest way to do this is by using the PrivateKeyMemoryStorage class. To create an instance of this class, you need to provide PrivateKey object(s) as its constructor parameter(s). In order to obtain PrivateKey from KeyStore, load the key from the generated file and provide an optional password. Please take a look at the following example:
InputStream privateCertStream = new FileInputStream("[path to certificate.pfx]");
String certificatePassword = "[password]";
KeyStore.PasswordProtection protection = new KeyStore.PasswordProtection(certificatePassword.toCharArray());
KeyStore keyStore = KeyStore.getInstance("PKCS12");
keyStore.load(privateCertStream, certificatePassword.toCharArray());
KeyStore.PrivateKeyEntry key = (KeyStore.PrivateKeyEntry) keyStore.getEntry("1", protection);
PrivateKeyMemoryStorage privateKeyStorage = new PrivateKeyMemoryStorage(key.getPrivateKey());In the example above, we used the PrivateKeyMemoryStorage class, which implements the PrivateKeyStorage interface. However, any implementation of PrivateKeyStorage could be used here - we do not restrict using custom code at this point.
Using PersonDetailsCache allows all Registration Systems to exchange persons’ details from their local systems via Service Bus in order to find international duplicates and ensure that the same person will not be registered twice.
If your infrastructure for the application using SDK consists of multiple servers or your listener and registration facade are running in separate processes, then additional configuration is required.
The most important thing to consider when choosing the way you want to host your listener is that it requires a shared storage between all instances of the SDK. Thus, when hosting the listener in the cloud (e.g. as Azure WebJob) or when having multiple instances of Registration System (and in effect: multiple instances of the SDK), each instance must access the same shared state.
The request has to be matched with response. In order for this correlation to work, an ID of the request message (so called Correlation Id) needs to be stored and later retrieved by our code.
For example, when sending the requests like:
registerPersonAndWaitForDetailsInCaseOfDuplicatesorgetDuplicatesthe Correlation Id is created for them. Once the information is back from another Registration System it also contains the same Correlation Id - this way the listener knows which response should be matched with the request.
SDK defines the PersonDetailsCache interface, which must be implemented by the client of the SDK and passed into RegistrationFacadeSettings.
public interface PersonDetailsCache {
/**
* Puts person details into storage mechanism.
*/
void put(PersonDetails personDetails);
/**
* Get person details with given correlation id from storage mechanism.
*
* @return PersonDetails object. If there is no entry associated with the given id, this method should return null.
*/
PersonDetails getByCorrelationId(String correlationId);
/**
* Deletes the entries from storage mechanism that are older than given date.
*/
void deleteOlderThan(Duration duration);
}Examples of implementation of PersonDetailsCache are:
FALLBACK: Only when
RegistrationFacadeand listener are running under the same application SDK usesPersonDetailsMemoryCacheinstance correctly. This default implementation of the interfacePersonDetailsCacheputs XML that is created in the response for Person details request to the memory cache.
When using local person identifier for Idempotency, you can change its hashing method. This can be done by implementing HashedPersonProcessor interface. Provided implementation needs to be passed to RegistrationFacadeSettings class when creating registration facade.
public interface HashedPersonProcessor {
/**
* Process provided hashed person type
*/
HashedPersonType process(HashedPersonType hashedPersonType);
}FALLBACK: SHA-512 hashing is used by default.
You can provide information about the current user interacting with the Registration System. This can be accomplished by providing implementation of ActorResolver interface.
public interface ActorResolver {
/**
* Returns name or identifier of actor
*/
String resolve();
}Such actor resolver could be much more advanced than SimpleActorResolver provided as a default implementation. In case of web application, actor could be fetched from current web request context.
FALLBACK:
SimpleActorResolverwith empty actor identifier is used by default.
In some cases the solution that is using SDK can not communicate via internet directly (for example it is placed in the DMZ). Only the proxy server is allowed to communicate via internet and all traffic has to go through it.
In this scenario the recommended way is to configure the proxy server to handle the traffic correctly. If for some reason this is impossible, there is a way to bypass the problem by using ProxySettings object.
ProxySettings proxySettings = new ProxySettings();
proxySettings.Type = java.net.Proxy.Type.HTTP;
proxySettings.HostName = "host name";
proxySettings.Port = 8080;FALLBACK: If not specified, the
ProxySettings.Typewill default tojava.net.Proxy.Type.HTTP.
Each SDK client method uses an instance com.fifa.connectservicebus.sdk.logging.Logger in order to log any errors that might happen during the application runtime. There is no default Logger implementation provided, as different parties could want a different way of storing logs.
public interface Logger {
/**
* Writes the diagnostic message at the debug level.
*/
void debug(String format, Object... args);
/**
* Writes the diagnostic message and exception at the debug level.
*/
void debug(Exception exception, String format, Object... args);
/**
* Writes the diagnostic message at the error level.
*/
void error(String format, Object... args);
/**
* Writes the diagnostic message and exception at the error level.
*/
void error(Exception exception, String message, Object... args);
}A frequent mistake when implementing the Logger is ignoring the args parameter when formatting the message. Example of the void debug(String message, Object... args) might be:
System.out.printf(message + "%n", args);When implementing void error(Exception exception, String message, Object... args) please make sure to handle the Exception properly, i.e. include the inner exceptions (if any) and the stack trace. The message itself might not be enough.
Once dependencies are ready you can create RegistrationFacade object:
RegistrationFacadeSettings registrationFacadeSettings = new RegistrationFacadeSettings();
registrationFacadeSettings.personDetailsCache = personDetailsCache; // 2.3.4.1 Person Details Cache
registrationFacadeSettings.hashedPersonProcessor = hashedPersonProcessor; // 2.3.4.2 Hashed Person Processor
registrationFacadeSettings.actorResolver = actorResolver; // 2.3.4.3 Actor Resolver
registrationFacadeSettings.proxySettings = proxySettings; // 2.3.4.4 Proxy Settings
RegistrationFacade registrationFacade = new RegistrationFacade(
connectIdEnvironment, // 2.3.1 Connect ID environment
clientCredentials, // 2.3.2 Client credentials
privateKeyStorage, // 2.3.3 Private key storage
registrationFacadeSettings, // 2.3.4 Registration Facade settings
logger); // 2.3.5 LoggerAfter creating facade, you can set up the background listener, which will listen and process new messages received from Connect Service Bus. This is the key element that every Registration System needs to implement.
When BackgroundListener receives a message with a request for person's details it will call a method getPersonDetails on PersonDetailsProvider passing FIFA ID of a person.
Therefore you have to provide implementation of PersonDetailsProvider that makes a lookup (e.g. in your database) and returns a valid PersonLocal XML from FIFA Data Standard.
Chapter 3.1 contains a guide on PersonLocal creation and serialization.
If for any reason record for a requested person is not found or cannot be returned, PersonDetailsProvider implementation should return null or empty string.
public interface PersonDetailsProvider {
/**
* Gets detailed information about person with given request
*
* @return the Person Local type from the Fifa Data Standard.
*/
String getPersonDetails(PersonDetailsRequest request);
}XML below is an example of data that should be returned by PersonDetailsProvider
<?xml version="1.0" encoding="UTF-8"?>
<PersonLocal xmlns="http://fifa.com/fc" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xmime="http://www.w3.org/2005/05/xmlmime" PersonFIFAId="105C3Z1" LocalFirstName="ΑΓΓΕΛΗΣ" LocalLastName="ΧΑΡΑΛΑΜΠΟΥΣ" LocalLanguage="gre" LocalCountry="CY" LocalSystemMAId="1234567" InternationalFirstName="ANGELIS" InternationalLastName="CHARALAMBOUS" Gender="male" DateOfBirth="1989-05-31" PlaceOfBirth="Larnaca" RegionOfBirth="Larnaca" CountryOfBirth="CY" Nationality="CY">
<NationalIdentifier Identifier="GHKJKLD123132132" NationalIdentifierNature="PassportNumber" Country="CY" DateFrom="2010-08-13" DateTo="2020-08-13"/>
<PlayerRegistration PersonFIFAId="105C3Z1" Status="active" OrganisationFIFAId="105C40I" RegistrationValidFrom="2003-04-11" RegistrationValidTo="2009-06-15" Discipline="Football" Level="amateur" RegistrationNature="Registration"/>
<PlayerRegistration PersonFIFAId="105C3Z1" Status="active" OrganisationFIFAId="105C40I" RegistrationValidFrom="2009-06-16" Discipline="Football" Level="pro" RegistrationNature="Registration"/>
<TeamOfficialRegistration PersonFIFAId="105C3Z1" Status="active" OrganisationFIFAId="105C40I" RegistrationValidFrom="2012-08-13" RegistrationValidTo="2014-08-13" Discipline="Futsal" TeamOfficialRole="Coach"/>
</PersonLocal>You can provide additional message handlers in order to set up additional Service Bus Listener capabilities. Each message handler implements MessageHandler interface.
public interface MessageHandler {
/**
* Tells the caller if the message type can be handled by this handler
* @param messageType A textual identifier of the message type
* @return true if the message handler can handle the message type, false otherwise
*/
boolean canHandle(String messageType);
/**
* Handles the message
* @param messageType A textual identifier of the message type
* @param message Message to handle
* @throws Exception
*/
void handle(String messageType, Message message) throws Exception;
}SDK contain few predefined message handlers:
Further chapters will cover their usage, by assuming all of them are added to messageHandlers collection, before creating the listener.
ArrayList<MessageHandler> messageHandlers = new ArrayList<MessageHandler>();When configuring the listener, an implementation of CacheCleanJob can be provided, that will run alongside the listener and take care of the removal of old messages.
public interface CacheCleanJob {
/**
* Starts a job responsible for the removal of old messages in the storage
* @param token - Token used for shutting the job down
*/
void run(CancellationToken token);
}You can use the default implementation provided by the SDK (PersonDetailsCacheCleanJob) or create your own.
PersonDetailsCache personDetailsCache = registrationFacadeSettings.personDetailsCache;
PersonDetailsCacheCleanJobSettings cleanJobSettings = new PersonDetailsCacheCleanJobSettings();
cleanJobSettings.setInterval(org.joda.time.Duration.standardHours(2));
cleanJobSettings.setDeleteOlderThan(org.joda.time.Duration.standardDays(1));
PersonDetailsCacheCleanJob cleanJob = new PersonDetailsCacheCleanJob(
personDetailsCache, // 2.3.4.1 Person Details Cache
cleanJobSettings,
logger); // 2.3.5 LoggerIn order to create BackgroundListener instance use previously bootstrapped RegistrationFacade:
BackgroundListener listener = registrationFacade.configureListener(
personDetailsProvider, // 2.4.1 Person Details Provider
messageHandlers, // 2.4.2 Message handlers
cleanJob); // 2.4.3 Clean jobTo start listening for messages and handling them run the following method:
listener.runInBackgroundThread();IMPORTANT NOTE: Only one listener shall be running at all times.
Additionally an instance of the BackgroundListener class exposes the following events:
personDetailsRequestReceivedEventpersonDetailsReceivedEventgenericMessageReceivedEventserviceBusExceptionEventThese events are automatically raised by the listener. You can use them to register your own event handlers and provide additional logic for handling received messages.
listener.personDetailsReceivedEvent.addHandler(details -> {
// do something with those details
});
listener.genericMessageReceivedEvent.addHandler(message -> {
byte[] bytes = message.getContent();
String actionName = message.getAction();
});If a message received from Connect Service Bus is processed properly by all registered handlers (no exceptions are thrown), then the message is marked as processed and deleted from the Connect Service Bus queue.
In case any handler throws an exception, a message will not be deleted from the Connect Service Bus but will be scheduled for later processing. BackgroundListener will retry to process this message.
After a series of unsuccessful handles, a message will be moved to a dead messages queue, which will be monitored by FIFA Connect ID Helpdesk.
Note that in most cases you would need to use Registration Facade instance, not the client. It is, however possible to get FIFA Connect ID Client out of facade as shown in below example.
FifaConnectIdClient fifaConnectIdClient = registrationFacade.getConnectIdClient(); // 2.3 Using Registration FacadeYou can also create a standalone FifaConnectIdClientImpl by injecting its dependencies into public constructor:
FifaConnectIdClientImpl fifaConnectIdClient = new FifaConnectIdClientImpl(
connectIdEnvironment, // 2.3.1 Connect ID environment
clientCredentials, // 2.3.2 Client credentials
logger); // 2.3.4 LoggerThe first section 3.1 guides through working with PersonLocal, introducing XML serialization and validation. These are particularly useful in PersonDetailsProvider, when responding the other organisation with person details via Service Bus.
Current version of the SDK supports two approaches to operations on Person entity:
Two following sections describe implementation steps which are necessary to cover both scenarios:
The last section 3.4 covers rarely used custom message type person details sharing via Service Bus.
SDK doesn't restrict any method of generating string with XML content. Recommended and by far the easiest method, however, is using PersonLocalXmlSerializerImpl class, that we provided in SDK. All that is required is to run the method serialize() which takes PersonLocal object as an input. All required fields (in accordance with FIFA Data Standard) must be provided, otherwise any deficiencies will be detected during validation. This rule applies for all model classes used in XML serialization process. Check below example to see how to create PersonLocal object with required and optional fields.
import com.fifa.fc.*;
PersonLocal personLocal = new PersonLocal();
// required fields
personLocal.setLocalLastName("ΧΑΡΑΛΑΜΠΟΥΣ");
personLocal.setGender(GenderType.MALE);
personLocal.setNationality(ISO3166CountryCode.CY);
XMLGregorianCalendar dateOfBirth = DatatypeFactory.newInstance().newXMLGregorianCalendarDate(1990, 11, 11, DatatypeConstants.FIELD_UNDEFINED);
personLocal.setDateOfBirth(dateOfBirth);
personLocal.setCountryOfBirth(ISO316613CountryCode.CY);
personLocal.setPlaceOfBirth("Larnaca");
personLocal.setLocalLanguage(ISO6392Type.GRE);
personLocal.setLocalCountry(ISO3166CountryCode.CY);
personLocal.setPersonFIFAId("105C3Z1");
// optional fields
personLocal.setLocalFirstName("ΑΓΓΕΛΗΣ");
personLocal.setLocalSystemMAId("1234567");
personLocal.setInternationalFirstName("ANGELIS");
personLocal.setInternationalLastName("CHARALAMBOUS");
personLocal.setRegionOfBirth("Larnaca");
personLocal.setSecondNationality(ISO3166CountryCode.GR);
personLocal.setPopularName("Angelis Angeli");PersonLocal created this way contains general information of the person whose details will be sent to other Registration System. Another business context are registrations. Each registration type can be included in XML file by adding new elements to lists that can be retrieved by following methods:
getPlayerRegistrations()getTeamOfficialRegistrations()getMatchOfficialRegistrations()getOrganisationOfficialRegistrations()As all types are very similar to each other (as all extend RegistrationType class), let's focus on how to set up PlayerRegistration and link it with PersonLocal object:
import com.fifa.fc.*;
// PersonDetailsRequest is available in getPersonDetails() method of PersonDetailsProvider interface
PersonDetailsRequest request = new PersonDetailsRequest("replyTo", "fifaId", "correlationId", null);
String personFIFAId = request.getUniqueFifaId();
String clubOrMemberAssociationId = "105C40I";
PersonLocal personLocal = new PersonLocal();
//add all mandatory fields
com.fifa.fc.PlayerRegistrationType playerRegistration = new com.fifa.fc.PlayerRegistrationType();
// required fields
playerRegistration.setPersonFIFAId(personFIFAId);
playerRegistration.setStatus(SimpleStatusType.ACTIVE);
playerRegistration.setOrganisationFIFAId(clubOrMemberAssociationId);
XMLGregorianCalendar registrationValidFrom = DatatypeFactory.newInstance().newXMLGregorianCalendarDate(2003, 4, 11, DatatypeConstants.FIELD_UNDEFINED);
playerRegistration.setRegistrationValidFrom(registrationValidFrom);
playerRegistration.setLevel(RegistrationLevelType.AMATEUR);
playerRegistration.setDiscipline(DisciplineType.FOOTBALL);
playerRegistration.setRegistrationNature(PlayerRegistrationNatureType.REGISTRATION);
// optional fields
XMLGregorianCalendar registrationValidTo = DatatypeFactory.newInstance().newXMLGregorianCalendarDate(2006, 6, 15, DatatypeConstants.FIELD_UNDEFINED);
playerRegistration.setRegistrationValidTo(registrationValidTo);
playerRegistration.setClubTrainingCategory(ClubTrainingCategoryType.CATEGORY_3);
// include player registration in PersonLocal
personLocal.getPlayerRegistrations().add(playerRegistration);Another important field, which can be set in PersonLocal in similar way as registrations, is Photo. This property itself is not required, but when using it, a mandatory instance of PictureEmbedded class needs to be passed as a constructor argument. SDK gives two possibilities when preparing PictureEmbedded object: using byte[] array (create(byte[] image)) or using path to local file (createFromLocalPath(String localPath)). Below example shows what's the approach here:
import com.fifa.fc.*;
import com.fifa.connectid.sdk.core.model.PictureEmbedded;
PersonLocal personLocal = new PersonLocal();
// add all mandatory fields
String absolutePathToPhoto = "C:\\image.png";
PictureType picture = PictureEmbedded.createFromLocalPath(absolutePathToPhoto);
// include photo in PersonLocal
personLocal.setPhoto(picture);SDK supports following image formats: jpg, png, gif, tif, bmp. Please mind that the maximum size of a person details message sent through Service Bus is approximately 10MB. You might want to ensure that the size of the photo does not make the entire PersonLocal object exceed that limit. A reasonable boundary for a PNG file is 8MB.
NationalIdentifier and LocalPersonName are both optional in PersonLocal scope and there is no difference in rules with setting their properties comparing to other fields. See example of NationalIdentifier below:
import com.fifa.fc.*;
PersonLocal personLocal = new PersonLocal();
// add all mandatory fields
NationalIdentifierType nationalIdentifier = new NationalIdentifierType();
// required fields
nationalIdentifier.setIdentifier("9876543210");
nationalIdentifier.setNationalIdentifierNature(NationalIdentifierNatureType.PASSPORT_NUMBER);
nationalIdentifier.setCountry(ISO3166CountryCode.CY);
// optional fields
nationalIdentifier.setDescription("NationalIdentifier test description");
XMLGregorianCalendar dateFrom = DatatypeFactory.newInstance().newXMLGregorianCalendarDate(2003, 4, 11, DatatypeConstants.FIELD_UNDEFINED);
nationalIdentifier.setDateFrom(dateFrom);
XMLGregorianCalendar dateTo = DatatypeFactory.newInstance().newXMLGregorianCalendarDate(2004, 6, 1, DatatypeConstants.FIELD_UNDEFINED);
nationalIdentifier.setDateTo(dateTo);
personLocal.getNationalIdentifiers().add(nationalIdentifier);After PersonLocal object is created, you need to pass it to serialize() method of PersonLocalXmlSerializerImpl service. Under the hood, this method creates XML string and executes validation against FIFA Data Standard. In case validation fails, XmlSerializationException will be thrown giving a message with all possible issues that were found during validation. As all of this happens in background listener, you should implement a proper error handling when catching the exception, so to get notified in case when XML response was not generated. Note that in case of exception thrown, Registration System that was asking for person details, won't receive a correct answer, so it's important to keep data structure valid and try to limit number of exceptions.
PersonLocal personLocal = new PersonLocal();
// add all mandatory fields
PersonLocalXmlSerializerImpl personLocalXmlSerializer = new PersonLocalXmlSerializerImpl();
String xmlString = null;
try {
xmlString = personLocalXmlSerializer.serialize(personLocal);
} catch (XmlSerializationException e) {
XmlValidationError[] validationErrors = e.getXmlValidationErrors();
// handle serialization exception
}When running operations that could possibly return person’s duplicates (such as registering persons, updating persons, etc.), methods will return responses with list of PersonDuplicateWithDetails. personDetails that have been received here contains an XML content, which is available in xmlData property. At this point application can store all details in local database (or handle them in a different way - depending on a need), so that it is possible to compare person being processed with their potential duplicates.
Optionally, after receiving XML string from xmlData, you may parse it into object. This can be done with a custom implementation, however the suggested solution here is to use PersonLocalXmlSerializerImpl class (provided by our SDK) and its deserialize() method returning PersonLocal object. Take a look at the following example:
String xmlString = personDuplicateWithDetails.getPersonDetails().getXmlData();
PersonLocalXmlSerializerImpl personLocalXmlSerializer = new PersonLocalXmlSerializerImpl();
try {
PersonLocal personLocal = personLocalXmlSerializer.deserialize(xmlString);
} catch (XmlDeserializationException e) {
String xmlContent = e.getXml();
Throwable innerException = e.getCause();
}As PersonLocalXmlSerializerImpl includes XML validation, there is no need of running additional validation over it. But, in case of internal unit tests or when instead of our helper tool, custom solution produces XML content, it is possible to check whether output is compliant with FIFA Data Standard. To achieve that, use XsdSchemaValidator as on following example:
String xmlString = "xmlString";
XsdSchemaValidator xsdSchemaValidator = new XsdSchemaValidator();
ValidationResult validationResult = xsdSchemaValidator.validate(xmlString);
if (!validationResult.isValid()) {
// handle validation errors
XmlValidationError[] validationErrors = validationResult.getErrors();
}The RegistrationFacade class covers full scenario of registering a person in FIFA Connect ID. If potential duplicates are found, Registration Facade will send requests for person details to other Registration Systems using Connect Service Bus and wait for their response (with timeout). The same logic needs to apply when one tries to update Person details or search for duplicates but does not intend to register a person even if no duplicates are found.
First create a person you want to register:
String organisationId = "id";
// setup player name(s)
PersonName personName = new PersonName("John", "Doe");
ArrayList<PersonName> personNames = new ArrayList<PersonName>();
personNames.add(personName);
PersonType person = new PersonType();
person.withDateOfBirth(new LocalDate(1994, 07, 06));
person.withGender(GenderType.MALE.value());
//setup registrations
PlayerRegistrationType playerRegistration = new PlayerRegistrationType();
playerRegistration.withOrganisationFIFAId(organisationId);
playerRegistration.withStatus("active");
playerRegistration.withLevel("Pro");
playerRegistration.withDiscipline("Football");
playerRegistration.withRegistrationNature("Registration");
ArrayList<PlayerRegistrationType> playerRegistrations = new ArrayList<PlayerRegistrationType>();
playerRegistrations.add(playerRegistration);
person.withPlayerRegistrations(playerRegistrations);
//finally create PersonData
PersonData personData = new PersonData(personNames, person);Then try to register a person using Registration Facade. The code snippet below shows an example handling (writing to console) of both scenarios, i.e. successful registration and potential duplicates found.
/* A record identifier in your database or any other key that is unique for a person.
This data will be stored hashed and cannot be decrypted.
For further information please consult section 3.2.1.1 Idempotency */
String personLocalId = "";
int timeoutInMilliseconds = 10000;
RegistrationResult result = registrationFacade.registerPersonAndWaitForDetailsInCaseOfDuplicates(personData, timeoutInMilliseconds, personLocalId);
if (result.isSuccessful()) {
System.out.println("Person successfully registered with unique FIFA ID: " + result.getUniqueFifaId() + ".");
} else {
System.out.println("Duplicates found.");
for (PersonDuplicateWithDetails duplicateWithDetails : result.getPersonDuplicateWithDetails()) {
String idOfDuplicatedPerson = duplicateWithDetails.getDuplicate().personFifaId();
double proximityScore = duplicateWithDetails.getDuplicate().proximityScore();
String dataReceived = duplicateWithDetails.getPersonDetails() == null
? "<detailed person data not received from other Registration System - timeout>"
: duplicateWithDetails.getPersonDetails().getXmlData();
System.out.println("FIFA ID: " + idOfDuplicatedPerson + ", score: " + proximityScore + ", FIFA Data XML: " + dataReceived);
}
}Service Bus listener must be up and running to receive person details. There may be cases where a person has no registrations, but still appears on the list of duplicates as FIFA Data Standard does not require any registrations to construct a valid object. Connect ID stores computed hashes, but has no way of knowing which Registration System to ask for the details, so as a result null XML will be returned. In addition to that, for every potential duplicate there will be a hash score computed, ranging from 0 (no resemblance) to 1 - exact match. Your system should be prepared to handle duplicates, considering both the possibility of receiving incomplete data and the value of the hash score.
Idempotency ensures that the same record is saved only once even when multiple registration requests are sent. To ensure that the same record is not registered in the system twice we recommend to pass person local identifier when registering person (Person local id can be a record identifier in your database or any other key that is unique for a person). Local identifier will be useful in case of retries on the client side (e.g. due to network issues or occasional client time-outs). It is sent and stored on the server in a hashed form (SHA-512 is used by default by SDK) and cannot be decrypted.
If you choose not to take advantage of the idempotency mechanism, you should expect that in rare situations FIFA_ID will be created on/by the server but you will not receive it on the client. Should this happen, the next time you try to register the same person, you will receive a duplicate pointing to your Registration System, but without any details (as your listener will not be able to provide details for the person which FIFA_ID you have not received).
The only thing that you need to do to start using idempotency mechanism is to pass additional parameter (local person identifier) to forceRegisterPerson or registerPersonAndWaitForDetailsInCaseOfDuplicates methods on RegistrationFacade. Based on the method that is used the system behaves as follows:
String personLocalIdentifier = "Person Local Id";
RegistrationResult result = registrationFacade.registerPersonAndWaitForDetailsInCaseOfDuplicates(personData, 10000, personLocalIdentifier);In the example above, the registerPersonAndWaitForDetailsInCaseOfDuplicates will check if there is no other registration with the same person local identifier. If the registration with the same person local identifier exists, it will be returned as a result. There will be no second registration nor the update of an existing one. If there is no registration with the same person local identifier, the method will run the default logic of searching for duplicates and registering a new person. Person local identifier will be stored on the server in the hashed form for the newly created record.
Please note, that the use of the forceRegisterPerson does not change the behaviour, i.e. a new person will not be created if the same person local identifier is used.
SDK provides support for registering a person with multiple names. Two scenarios will usually require such a feature:
Support for such a scenario depends on the way person registration is used.
com.fifa.connectid.sdk.core.xmlparser.models.PersonDataIn this case, before registering a person, you need to create a list of pairs of names (ArrayList<PersonName>) . The following example shows the most sophisticated scenario when a single person has both: local name, international name and maiden name provided. Although two pairs of names will be used in minority of cases and three pairs hardly ever, the example is instructive.
String internationalFirstName = "Olga";
String internationalLastName = "Terekhova";
String localFirstName = "Ольга";
String localLastName = "Терехова";
String localMaidenName = "Бессолова";
PersonName personInternationalName = new PersonName(internationalFirstName, internationalLastName);
PersonName personLocalName = new PersonName(localFirstName, localLastName);
PersonName personMaidenName = new PersonName(localFirstName, localMaidenName);
// setup player name(s)
ArrayList<PersonName> personNames = new ArrayList<PersonName>();
personNames.add(personInternationalName);
personNames.add(personLocalName);
personNames.add(personMaidenName);Please keep in mind that, especially in the Beta environment, some of the listeners of other Registration Systems might not be working. Methods relying on communication with other Registration Systems' listeners will wait for a specified period of time for the message from them to arrive and will return without them afterwards.
If you are certain that both your and the other Registration System's listener are up and running and you still do not receive person details, make sure that a valid implementation of PersonDetailsCache is used. More on the subject can be found in the chapter on Person details cache.
Detailed explanation of handling aforementioned issues can be found under this FAQ article.
First create two persons and register them:
String organisationId = "id";
// setup player name(s)
PersonName person1Name = new PersonName("John", "Doe");
ArrayList<PersonName> person1Names = new ArrayList<PersonName>();
person1Names.add(person1Name);
PersonName person2Name = new PersonName("John", "Kowalsky");
ArrayList<PersonName> person2Names = new ArrayList<PersonName>();
person2Names.add(person2Name);
//setup date of birth
PersonType person = new PersonType();
LocalDate dateOfBirth = new LocalDate(1994, 07, 06);
person.withDateOfBirth(dateOfBirth);
//setup registrations
PlayerRegistrationType registration = new PlayerRegistrationType();
registration.withOrganisationFIFAId(organisationId);
registration.withStatus("active");
registration.withLevel("Pro");
registration.withDiscipline("Football");
registration.withRegistrationNature("Registration");
ArrayList<PlayerRegistrationType> registrations = new ArrayList<PlayerRegistrationType>();
registrations.add(registration);
person.withPlayerRegistrations(registrations);
//finally create PersonData
PersonData person1Data = new PersonData(person1Names, person);
PersonData person2Data = new PersonData(person2Names, person);
//register two different players
registrationFacade.forceRegisterPerson(person1Data);
registrationFacade.forceRegisterPerson(person2Data);Then try to update second person using Registration Facade with names of first person. The code snippet below shows an example handling (writing to console) of both scenarios, i.e. successful update and potential duplicates found. Please note that this operation will throw an InvalidClientDataException if you lack the permissions to perform it (the player has active registrations, none of which belongs to your Registration System).
final int timeoutInMilliseconds = 10000;
UpdateResult result = registrationFacade.updatePersonAndWaitForDetailsInCaseOfDuplicates(personId, names, dateOfBirth, gender, timeoutInMilliseconds);
if (result.isSuccessful()) {
System.out.println("Person successfully updated.");
} else {
System.out.println("Duplicates found.");
for (PersonDuplicateWithDetails duplicateWithDetails : result.getPersonDuplicateWithDetails()) {
String idOfDuplicatedPerson = duplicateWithDetails.getDuplicate().personFifaId();
double proximityScore = duplicateWithDetails.getDuplicate().proximityScore();
String dataReceived = duplicateWithDetails.getPersonDetails() == null
? "<detailed person data not received from other Registration System - timeout>"
: duplicateWithDetails.getPersonDetails().getXmlData();
System.out.println("FIFA ID: " + idOfDuplicatedPerson + ", score: " + proximityScore + ", FIFA Data XML: " + dataReceived);
}
}If you need to get a list of duplicates for a person, method getDuplicates can be used. This method looks for duplicates in Connect ID service. If any duplicate is found requests for person details are sent to relevant Registration Systems. It is possible to look for duplicates only within specific organisations by providing organisationsIds argument.
final int timeoutInMilliseconds = 10000;
Collection<PersonDuplicateWithDetails> foundDuplicates = registrationFacade.getDuplicates(personData, timeoutInMilliseconds);
if (foundDuplicates.size() > 0) {
System.out.println("Duplicates found.");
for (PersonDuplicateWithDetails duplicateWithDetails : foundDuplicates) {
String idOfDuplicatedPerson = duplicateWithDetails.getDuplicate().personFifaId();
double proximityScore = duplicateWithDetails.getDuplicate().proximityScore();
String dataReceived = duplicateWithDetails.getPersonDetails() == null
? "<detailed person data not received from other Registration System - timeout>"
: duplicateWithDetails.getPersonDetails().getXmlData();
System.out.println("FIFA ID: " + idOfDuplicatedPerson + ", score: " + proximityScore + ", FIFA Data XML: " + dataReceived);
}
}To get the list of duplicates for a registered person, use method getDuplicatesExceptTrustedKnownDuplicates. To ignore duplicates marked as known duplicate by trusted organisations, please provide optional trustedOrganisationsIds argument.
final String personFifaId = "105C40T";
ArrayList<String> trustedOrganisationsIds = new ArrayList<String>();
final int timeoutInMilliseconds = 10000;
DuplicatesOfRegisteredPerson foundDuplicates = registrationFacade.getDuplicatesExceptTrustedKnownDuplicates(personFifaId, trustedOrganisationsIds, timeoutInMilliseconds);Registration Facade covers scenario of person registration/update/search, but for other functionalities FIFA Connect ID Client described in the next chapter must be used.
In particular FIFA Connect ID Client must be used for:
Currently there is no request throttling in API, but it's recommended not to exceed 10 concurrent connections. Too many requests to API may result in requests time outs. In case you plan to do a batch import of person records, please contact support team so that the infrastructure can be scaled up accordingly.
This chapter discusses all operations on a Person entity, e.g. Registration, Update, Merge, etc. It is different from chapter 3.2 Working with Registration Facade in that operations described here do not involve a duplicate check. A developer who wants to perform a duplicate check via Service Bus should either refer to chapter 3.2 or implement communication via Service Bus by themselves.
In order to register a person in FIFA Connect ID service, provide a PersonData object. Here is an example, that registers a person:
List<PersonName> names = Arrays.asList(
new PersonName("ΑΓΓΕΛΗΣ", "ΧΑΡΑΛΑΜΠΟΥΣ"), // local name
new PersonName("ANGELIS", "CHARALAMBOUS")); // international name
PersonType person = new PersonType();
person.withDateOfBirth(new LocalDate(1980, 10, 10));
// fill up registrations
PersonData personData = new PersonData(names, person);
/* A record identifier in your database or any other key that is unique for a person.
This data will be stored hashed and cannot be decrypted.
For further information please consult section 3.2.1.1 Idempotency */
String personLocalId = "";
try {
String personFifaId = fifaConnectIdClient.registerPerson(personData, personLocalId);
}
catch(AuthenticationException ex)
{
// invalid client credentials
}
catch(UnauthorizedException ex)
{
// unauthorized
}
catch (ValidationException ex) {
// validation error occurred
}
catch (InvalidClientDataException ex) {
// data sent to the service was invalid
BadRequestResponseType badRequest = ex.getBadRequestResponse();
}
catch (FifaDuplicatedPersonFoundException ex) {
// possible duplicates were found
List<PersonDuplicateType> duplicates = ex.getGetDuplicatesResponse().duplicates();
}
catch (TooManyRequestsException ex) {
// call rate limit was exceeded
int retryAfterInSeconds = ex.getRetryAfter();
}
catch (FifaConnectIdException ex) {
// some other error occurred, see the details
ServiceResponse<Object> serviceResponse = ex.getServiceResponse();
}In order to register persons in parallel, use ExecutorService object and submit registration tasks. Please note that in order to optimize costs of test environment we keep it small-scale. Let us know upfront if you plan to test bulk registration, so we can scale up the environment. Additionally we recommend not exceeding 20 concurrent registrations to avoid performance degradation of the service. Take a look at the following example:
final LocalDatabase database = new LocalDatabase();
List<Player> playersToRegister = database.getNotRegisteredPlayers();
final int maximumNumberOfThreadsInAThreadPool = 10;
final int timeout = 300;
final TimeUnit timeoutTimeUnit = TimeUnit.SECONDS;
ExecutorService executor = Executors.newFixedThreadPool(maximumNumberOfThreadsInAThreadPool);
try {
for (final Player player: playersToRegister) {
executor.submit(new Callable<String>() {
@Override
public String call() {
PersonData personData = CreatePerson(player);
try {
String fifaUniqueId = fifaConnectIdClient.registerPerson(personData);
database.updateFifaUniqueId(player, fifaUniqueId);
return fifaUniqueId;
} catch (Exception ex) {
// some error occurred, see the details
return null;
}
}
});
}
} finally {
executor.shutdown();
executor.awaitTermination(timeout, timeoutTimeUnit);
// Waits until all tasks have completed execution, or the timeout occurs, or the current thread is interrupted
}To force the registration process (proceed even if potential duplicates are found):
/* A record identifier in your database or any other key that is unique for a person.
This data will be stored hashed and cannot be decrypted.
For further information please consult section 3.2.1.1 Idempotency */
String personLocalId = "";
try {
String personFifaId = fifaConnectIdClient.forceRegisterPerson(personData, personLocalId);
}
catch(AuthenticationException ex)
{
// invalid client credentials
}
catch(UnauthorizedException ex)
{
// unauthorized
}
catch (ValidationException ex) {
// validation error occurred
}
catch (InvalidClientDataException ex) {
// data sent to the service was invalid
BadRequestResponseType badRequest = ex.getBadRequestResponse();
}
catch (TooManyRequestsException ex) {
// call rate limit was exceeded
int retryAfterInSeconds = ex.getRetryAfter();
}
catch (FifaConnectIdException ex) {
// some other error occurred, see the details
ServiceResponse<Object> serviceResponse = ex.getServiceResponse();
}This method will throw FifaPersonMergedException when you try to get data for a person that has been previously merged (refer to section 3.3.4 Merging/unmerging persons). The exception will contain data about requested person together with primary person id. To get the information associated with the specified FIFA ID such as a date of birth or list of person registrations:
String personFifaId = "BVGE8T6";
try {
PersonType person = fifaConnectIdClient.getPerson(personFifaId);
LocalDate dateOfBirth = person.dateOfBirth();
}
catch (AuthenticationException ex){
// invalid client credentials
}
catch (UnauthorizedException ex){
// unauthorized
}
catch (ValidationException ex) {
// validation error occurred
}
catch (InvalidClientDataException ex) {
// data sent to the service was invalid
BadRequestResponseType badRequest = ex.getBadRequestResponse();
}
catch (FifaEntityNotFoundException ex) {
// could not find the person
ServiceResponse<Object> serviceResponse = ex.getServiceResponse();
}
catch (FifaEntityDeletedException ex){
// person has been deleted
ServiceResponse<Object> serviceResponse = ex.getServiceResponse();
}
catch (FifaPersonMergedException ex) {
// requested person has been merged
PersonType person = (PersonType)ex.getRequestedEntity();
String primaryPersonId = ex.getPrimaryEntityId();
}
catch (TooManyRequestsException ex) {
// call rate limit was exceeded
int retryAfterInSeconds = ex.getRetryAfter();
}
catch (FifaConnectIdException ex) {
// some other error occurred, see the details
ServiceResponse<Object> serviceResponse = ex.getServiceResponse();
}To merge two persons into a single one use mergePersons method available on FifaConnectIdClient. As a result, the primary person data will be kept. No more operations should be executed on the secondary person. Attempt to get secondary person's data will result in 301 error code. Please refer to section 3.3.3 Getting person data. This operation can end with conflict error under specific conditions. It can happen when previous merge/unmerge operation is not yet completed on the same persons. As a result FifaConflictException will be thrown and client should retry operation later.
Here is an example how to merge persons:
try {
PersonType person = fifaConnectIdClient.mergePersons(primaryPersonId, secondaryPersonId);
}
catch (AuthenticationException ex) {
// invalid client credentials
}
catch (UnauthorizedException ex) {
// unauthorized
}
catch (ValidationException ex) {
// validation error occurred
}
catch (InvalidClientDataException ex) {
// data sent to the service was invalid
BadRequestResponseType badRequest = ex.getBadRequestResponse();
}
catch (FifaConflictException ex) {
// a conflicting operation is currently in progress
ConflictResponseType response = ex.getResponse();
}
catch (FifaEntityNotFoundException ex) {
// could not find one of specified persons
ServiceResponse<Object> serviceResponse = ex.getServiceResponse();
}
catch (TooManyRequestsException ex) {
// call rate limit was exceeded
int retryAfterInSeconds = ex.getRetryAfter();
}
catch (FifaConnectIdException ex) {
// some other error occurred, see the details
ServiceResponse<Object> serviceResponse = ex.getServiceResponse();
}In order to revert merge operation call unmergePersons method with the same arguments.
To retrieve all merged secondary FIFA IDs for a specific person, use the getMergedSecondaryFifaIdsForPerson method provided by the FifaConnectIdClient.
Note that only persons directly merged into the provided FIFA ID will be considered (those that can be unmerged).
final String personFifaId = "";
try {
List<String> personSecondaryFifaIds = fifaConnectIdClient.getMergedSecondaryFifaIdsForPerson(personFifaId);
}
catch (AuthenticationException ex) {
// invalid client credentials
}
catch (UnauthorizedException ex) {
// unauthorized
}
catch (ValidationException ex) {
// validation error occurred
}
catch (InvalidClientDataException ex) {
// data sent to the service was invalid
BadRequestResponseType badRequest = ex.getBadRequestResponse();
}
catch (FifaEntityNotFoundException ex) {
// could not find one of specified persons
ServiceResponse<Object> serviceResponse = ex.getServiceResponse();
}
catch (FifaEntityDeletedException ex) {
// person has been deleted
ServiceResponse<Object> serviceResponse = ex.getServiceResponse();
}
catch (TooManyRequestsException ex) {
// call rate limit was exceeded
int retryAfterInSeconds = ex.getRetryAfter();
}
catch (FifaConnectIdException ex) {
// some other error occurred, see the details
ServiceResponse<Object> serviceResponse = ex.getServiceResponse();
}To get a list of people a person may be duplicated with:
try {
List<PersonDuplicateType> potentialDuplicates = fifaConnectIdClient.getPersonDuplicates(personData);
}
catch(AuthenticationException ex)
{
// invalid client credentials
}
catch(UnauthorizedException ex)
{
// unauthorized
}
catch (ValidationException ex) {
// validation error occurred
}
catch (InvalidClientDataException ex) {
// data sent to the service was invalid
BadRequestResponseType badRequest = ex.getBadRequestResponse();
}
catch (TooManyRequestsException ex) {
// call rate limit was exceeded
int retryAfterInSeconds = ex.getRetryAfter();
}
catch (FifaConnectIdException ex) {
// some other error occurred, see the details
ServiceResponse<Object> serviceResponse = ex.getServiceResponse();
}This method is expected to be used rarely, e.g. in cases when Registration System chooses to do a duplicate check without the registration. It is possible to look for duplicates only within specific organisations by providing organisationsIds argument.
To get a list of people a registered person may be duplicated with:
final String personFifaId = "105C408";
ArrayList<String> trustedOrganisationsIds = new ArrayList<String>();
try {
GetDuplicatesOfRegisteredPersonResponseType duplicates = fifaConnectIdClient.getPersonDuplicatesExceptTrustedKnownDuplicates(personFifaId, trustedOrganisationsIds);
}
catch(AuthenticationException ex){
// invalid client credentials
}
catch(UnauthorizedException ex){
// unauthorized
}
catch (ValidationException ex) {
// validation error occurred
}
catch (InvalidClientDataException ex) {
// data sent to the service was invalid
BadRequestResponseType badRequest = ex.getBadRequestResponse();
}
catch (TooManyRequestsException ex) {
// call rate limit was exceeded
int retryAfterInSeconds = ex.getRetryAfter();
}
catch (FifaConnectIdException ex) {
// some other error occurred, see the details
ServiceResponse<Object> serviceResponse = ex.getServiceResponse();
}When registering a person for the first time we need to provide an object of PersonType class. It is also possible to update an existing record (provided that we know the person's FIFA ID) by adding or editing its registrations. In order to do that, use the class AddRegistrationsRequestType, UpdateRegistrationsRequestType (depending on the operation) and fill information about the registrations. Note, that each person always contains four collections of registrations:
In the examples below, only player registrations are used - the other 3 collections remain empty (they are not set).
Important note: Operation that results in Member Association (OrganisationFifaId) being changed for a given registration constitutes a transfer in Connect ID. Only one transfer at the same time is allowed. If you want to perform multiple transfers, please call
addRegistrationsorupdateRegistrationsmethods separately for each transfer.
Note that a registration is added in a National Association and not in a Club. This is not a coincidence - FIFA Connect ID Service, although allowed to store Clubs in general, is not allowed to store persons' assignments to Clubs. Server will return an error should the Client try to register a person within a Club.
String myPersonFifaId = "16N9M75";
String organisationId = "1007UDF";
PlayerRegistrationType exampleRegistration = new PlayerRegistrationType();
exampleRegistration.withDiscipline("Football");
exampleRegistration.withRegistrationNature("Registration");
exampleRegistration.withLevel("Pro");
exampleRegistration.withStatus("active");
// this part may change in the future when authorization is implemented and it won't be possible for an Member Association to add registration for any other organisation than itself
exampleRegistration.withOrganisationFIFAId(organisationId);
ArrayList<PlayerRegistrationType> playerRegistrations = new ArrayList<PlayerRegistrationType>();
playerRegistrations.add(exampleRegistration);
PersonRegistrationsType personRegistrations = new PersonRegistrationsType();
personRegistrations.withPlayerRegistrations(playerRegistrations);
AddRegistrationsRequestType request = new AddRegistrationsRequestType();
request.withPersonId(myPersonFifaId);
request.withRegistrations(personRegistrations);
try {
PersonType result = fifaConnectIdClient.addRegistrations(request, false);
}
catch(AuthenticationException ex)
{
// invalid client credentials
}
catch(UnauthorizedException ex)
{
// unauthorized
}
catch (ValidationException ex) {
// validation error occurred
}
catch (InvalidClientDataException ex) {
// data sent to the service was invalid
BadRequestResponseType badRequest = ex.getBadRequestResponse();
}
catch (FifaEntityNotFoundException ex) {
// could not find the person
ServiceResponse<Object> serviceResponse = ex.getServiceResponse();
}
catch (TooManyRequestsException ex) {
// call rate limit was exceeded
int retryAfterInSeconds = ex.getRetryAfter();
}
catch (FifaConnectIdException ex) {
// some other error occurred, see the details
ServiceResponse<Object> serviceResponse = ex.getServiceResponse();
}In order to execute a request we need to know the registrations we want to update and their new values. Note that the order of registrations is important. Operation will try to change the first item in "old" list with the first item in the "new" list, etc.
"Old" list should contain only those registrations, which you want to update. For example, when person has four registrations and you want to update only two of them, you just need to provide these two.
String myPersonFifaId = "16N9M75";
String organisationId = "1007UDF";
PersonType person = fifaConnectIdClient.getPerson(myPersonFifaId);
PersonRegistrationsType personOldRegistrations = new PersonRegistrationsType();
personOldRegistrations.withPlayerRegistrations(person.playerRegistrations());
PlayerRegistrationType updatedRegistration1 = new PlayerRegistrationType();
updatedRegistration1.withDiscipline("Football");
updatedRegistration1.withRegistrationNature("Registration");
updatedRegistration1.withLevel("Pro");
updatedRegistration1.withStatus("active");
updatedRegistration1.withOrganisationFIFAId(organisationId);
PlayerRegistrationType updatedRegistration2 = new PlayerRegistrationType();
updatedRegistration2.withDiscipline("BeachSoccer");
updatedRegistration2.withRegistrationNature("Registration");
updatedRegistration2.withLevel("Amateur");
updatedRegistration2.withStatus("active");
updatedRegistration2.withOrganisationFIFAId(organisationId);
ArrayList<PlayerRegistrationType> playerNewRegistrations = new ArrayList<PlayerRegistrationType>();
playerNewRegistrations.add(updatedRegistration1);
playerNewRegistrations.add(updatedRegistration2);
PersonRegistrationsType personNewRegistrations = new PersonRegistrationsType();
personNewRegistrations.withPlayerRegistrations(playerNewRegistrations);
UpdateRegistrationsRequestType request = new UpdateRegistrationsRequestType();
request.withPersonId(myPersonFifaId);
request.withOldRegistrations(personOldRegistrations);
request.withNewRegistrations(personNewRegistrations);
try {
PersonType result = fifaConnectIdClient.updateRegistrations(request, false);
}
catch(AuthenticationException ex)
{
// invalid client credentials
}
catch(UnauthorizedException ex)
{
// unauthorized
}
catch (InvalidClientDataException ex) {
// data sent to the service was invalid or the Registration System lacks permission to perform the operation
BadRequestResponseType badRequest = ex.getBadRequestResponse();
}
catch (FifaEntityNotFoundException ex) {
// could not find the person
ServiceResponse<Object> serviceResponse = ex.getServiceResponse();
}
catch (TooManyRequestsException ex) {
// call rate limit was exceeded
int retryAfterInSeconds = ex.getRetryAfter();
}
catch (FifaConnectIdException ex) {
// some other error occurred, see the details
ServiceResponse<Object> serviceResponse = ex.getServiceResponse();
}Please note that each time an operation succeed, you will receive an object of class PersonType containing the current status of a person with all their registrations. This feature may be used for troubleshooting but also to synchronize the local data with a central DB (ID Directory).
Also note that errors are not thrown if you perform an operation which would result in the object not changing its state. For example, if you want to add a registration for a Football Player, Amateur in France, and such a registration already exists, error will not be thrown and the operation will succeed.
We do not provide SDK method for removing registrations. Correct operation here would be updating registration by setting its status to inactive (deactivation). If you are certain that a registration should be removed (e.g. it has been added by mistake), please contact our Helpdesk.
Note, that when updating the name of a person, you need to specify all pairs of names. For example if you originally registered a person with both local and international name, you need to specify both pairs even if you are changing only one name. Connect ID is only able to replace an existing set of names with a new set. The reason for this is personal data protection, which allows the service to store hashes but not names.
To update a person associated with the specified FIFA ID:
ArrayList<PersonName> names = new ArrayList<PersonName>();
names.add(new PersonName("first name", "last name"));
try {
PersonType updatedPerson = fifaConnectIdClient.updatePerson("105C40T", names, new LocalDate(1980, 10, 10), "male", false);
}
catch (InvalidClientDataException ex) {
// data sent to the service was invalid or the Registration System lacks permission to perform the operation
BadRequestResponseType badRequest = ex.getBadRequestResponse();
}
catch(AuthenticationException ex) {
// invalid client credentials
}
catch(UnauthorizedException ex) {
// unauthorized
}
catch (ValidationException ex) {
// validation error occurred
}
catch (FifaEntityNotFoundException ex) {
// could not find the person
ServiceResponse<Object> serviceResponse = ex.getServiceResponse();
}
catch (TooManyRequestsException ex) {
// call rate limit was exceeded
int retryAfterInSeconds = ex.getRetryAfter();
}
catch (FifaConnectIdException ex) {
// some other error occurred, see the details
ServiceResponse<Object> serviceResponse = ex.getServiceResponse();
}By default, all registrations are stored in a single national registration system. It is however possible to connect additional system to FIFA Connect ID services. As an example we may consider the [main] national registration system being responsible for Amateur players only and an additional, external system – for Professionals. In such a setup it is important that Connect ID is able to properly route requests for player details sent by other Registration Systems via Service Bus.
In order for this routing to work correctly, an external system, for each of registrations it manages (professional ones), must provide its unique identifier (System ID).
System ID can be set by using setSystemId() method. See below example:
String organisationId = "105C8LX";
String systemId = "105C8LX_SystemName";
PlayerRegistrationType newPlayerRegistration = new PlayerRegistrationType();
newPlayerRegistration.withLevel("Pro");
newPlayerRegistration.withDiscipline("Football");
newPlayerRegistration.withRegistrationNature("Registration");
newPlayerRegistration.withStatus("Active");
newPlayerRegistration.withOrganisationFIFAId(organisationId);
newPlayerRegistration.withSystemId(systemId); // The system identifier is created and passed along with the access credentials.There is no need of setting System ID if registration is added by a default system. In this case the <null> value should be used.
It is possible to bulk deactivate a set of given registrations using bulkDeactivateRegistrations() method, which is available in FifaConnectIdClient class. As an input method takes a list of person registrations that will be deactivated. Only listed registrations will be deactivated - all other registrations that exist in the context of a given person will be left unchanged. Each registration needs to represent the current state (including status), otherwise server won't recognize it and will return error message that registration doesn't exist. One deactivation request can have up to 500 registrations in total (player, match official, team official and organisation official). Below you can find an example of bulk deactivation usage:
ArrayList<PersonDeactivateType> personsToDeactivate = new ArrayList<PersonDeactivateType>();
for (Map.Entry<String, PersonData> person: persons.entrySet()) {
String personId = person.getKey();
PersonData personData = person.getValue();
// pick registrations to deactivate
List<PlayerRegistrationType> playerRegistrations = personData.getPerson().playerRegistrations();
ArrayList<PlayerRegistrationType> playerRegistrationsToDeactivate = new ArrayList<PlayerRegistrationType>();
playerRegistrationsToDeactivate.add(playerRegistrations.get(0));
playerRegistrationsToDeactivate.add(playerRegistrations.get(2));
List<TeamOfficialRegistrationType> teamOfficialRegistrations = personData.getPerson().teamOfficialRegistrations();
ArrayList<TeamOfficialRegistrationType> teamOfficialRegistrationsToDeactivate = new ArrayList<TeamOfficialRegistrationType>();
teamOfficialRegistrationsToDeactivate.add(teamOfficialRegistrations.get(3));
PersonRegistrationsType personRegistrationsToDeactivate = new PersonRegistrationsType();
personRegistrationsToDeactivate.withPlayerRegistrations(playerRegistrationsToDeactivate);
personRegistrationsToDeactivate.withTeamOfficialRegistrations(teamOfficialRegistrationsToDeactivate);
// deactivate all Match Official Registrations
personRegistrationsToDeactivate.withMatchOfficialRegistrations(personData.getPerson().matchOfficialRegistrations());
PersonDeactivateType personToDeactivate = new PersonDeactivateType();
personToDeactivate.withPersonId(personId);
personToDeactivate.withRegistrations(personRegistrationsToDeactivate);
personsToDeactivate.add(personToDeactivate);
}
BulkDeactivateRegistrationsRequestType request = new BulkDeactivateRegistrationsRequestType();
request.withPersons(personsToDeactivate);
try {
BulkDeactivateRegistrationsResponseType response = fifaConnectIdClient.bulkDeactivateRegistrations(request);
// Get persons for whom at least one registration has failed during deactivation
ArrayList<BulkDeactivateRegistrationsResult> failedRegistrations = new ArrayList<BulkDeactivateRegistrationsResult>();
for(BulkDeactivateRegistrationsResult result : response.results()) {
if (!result.success()) {
failedRegistrations.add(result);
}
}
}
catch (UnauthorizedException e) {
// unauthorized
}
catch (InvalidClientDataException e) {
// data sent to the service was invalid
BadRequestResponseType badRequest = e.getBadRequestResponse();
}
catch (AuthenticationException e) {
// invalid client credentials
}
catch (TooManyRequestsException ex) {
// call rate limit was exceeded
int retryAfterInSeconds = ex.getRetryAfter();
}
catch (FifaConnectIdException e) {
// some other error occurred, see the details
}
catch (ValidationException ex) {
// validation error occurred
}bulkDeactivateRegistrations() returns BulkDeactivateRegistrationsResponseType. Then it is possible to check the HTTP status of the operation as well as get results of deactivation process (by calling getResults() method on the response object). This (getResults()) method gives a list of BulkDeactivateRegistrationsResult. Each instance of BulkDeactivateRegistrationsResult contains information about a status of specific person oriented operation. Possible methods are: getPersonId(), getSuccess(), getException(). In case deactivation fails for given person, getSuccess() will be set as false and additional information will be provided as an exception.
Please note that bulk deactivation is a heavy operation that affects server resources. Before running it please
int timeoutInSeconds = 60 * 10;
IdDirectoryServiceClientImpl.setRequestTimeoutInSeconds(timeoutInSeconds);Every Registration System that has or used to have a certain person's registration is known to be their DATA HOLDER. If Connect ID Service is aware of all data holders of a given FIFA_ID, it is able to properly build electronic player's passport and send notifications about data changes.
However, in some scenarios newly integrated Registration System may not be automatically registered as a data holder of a person. This will happen e.g. if they try to register an inactive player, they find a duplicate (because that player is active elsewhere) and simply store the FIFA_ID of a duplicate in their Registration System. Connect ID Service will not be aware that Registration System just became a data holder of that person.
Therefore, an additional mechanism of data holding declaration had been introduced. Registration System can now claim to be a data holder of a given FIFA_ID and be included in the data holders list. To claim that your Registration System is person's data holder, FifaConnectIdClient.registerAsDataHolderOfPerson method should be called.
try
{
fifaConnectIdClient.registerAsDataHolderOfPerson(personFifaId);
}
catch (ValidationException ex)
{
// provided data did not pass validation
}
catch (AuthenticationException ex)
{
// invalid client credentials
ServiceResponse<Object> details = ex.getServiceResponse();
}
catch (UnauthorizedException ex)
{
// unauthorized
ServiceResponse<Object> details = ex.getServiceResponse();
}
catch (InvalidClientDataException ex)
{
// data sent to the service was invalid
BadRequestResponseType details = ex.getBadRequestResponse();
}
catch (FifaPersonMergedException ex)
{
// requested person has been merged
Object person = ex.getRequestedEntity();
String primaryPersonId = ex.getPrimaryEntityId();
}
catch (FifaEntityNotFoundException ex)
{
// could not find the person
ServiceResponse<Object> operationResponse = ex.getServiceResponse();
}
catch (FifaEntityDeletedException ex)
{
// person has been deleted
ServiceResponse<Object> operationResponse = ex.getServiceResponse();
}
catch (FifaConnectIdException ex)
{
// some error occurred, see the details
ServiceResponse<Object> operationResponse = ex.getServiceResponse();
}The method is idempotent i.e. can be called multiple times without any negative side-effects. It is important to note that the method only enqueues your registration request. The actual processing happens in the background. The implications are twofold: 1. The call will return as soon as the request is accepted. 2. It may take some time for the system to process the request
In order to confirm that your request has been processed, you can call another method FifaConnectIdClient.getDataHoldersOfPerson(String personFifaId) which returns the list of systems who are Data Holders of the given person FIFA_ID. After successful processing, the list should contain your Registration System's ID. However, it is not recommended to call it after every call to registerAsDataHolderOfPerson.
You can share the details of any person with another system over the Service Bus. It is important for you to agree on the message type that will be used both by the sender and the recipient.
You can send a PersonLocal object to any system using an instance of PersonLocalSender. Please note that the messageType argument has to be agreed with the receiving system so that they can register a handler for it. You can find more information on the subject in our portal.
PersonLocalSender personLocalSender = new PersonLocalSender(registrationFacade.getServiceBusClient());
String recipient = "105C3ZB_CSRS";
String messageType = "register-for-tournament";
PersonLocal personLocal = new PersonLocal(); //
try {
personLocalSender.send(personLocal, recipient, messageType);
} catch (XmlSerializationException e) {
// handle serialization exception
} catch (ValidationException e) {
// validation error occurred
} catch (AuthenticationException e) {
// invalid client credentials
} catch (UnauthorizedException e) {
// unauthorized
} catch (QueueNotFoundException e) {
// invalid recipient
} catch (FifaConnectServiceBusException e) {
ServiceResponse<Object> details = e.getServiceResponse();
}In order to receive Person's details sent by another system over the Service Bus (according to section 3.4.1) you need to register an extra message handler for the agreed message type. Our SDK will take care of validation and deserialization of the message. All you need to provide is an implementation of your own handler that will be invoked when the PersonLocal object is received.
import com.fifa.connectid.sdk.messageHandlers.PersonLocalReceivedHandler;
import com.fifa.fc.PersonLocal;
public class YourPersonLocalReceivedHandler implements PersonLocalReceivedHandler {
@Override
public void handle(PersonLocal personLocal, String sender) throws Exception {
// TODO: implement handle() method
}
}When configuring the Listener add an extra message handler:
YourPersonLocalReceivedHandler personLocalReceivedHandler = new YourPersonLocalReceivedHandler();
String messageType = "expected-message-type";
PersonLocalMessageHandler personLocalMessageHandler = new PersonLocalMessageHandler(personLocalReceivedHandler, messageType);
// add new message handlers to the collection of existing ones
messageHandlers.add(personLocalMessageHandler);All operations that refer to Organisations are performed using the FifaConnectIdClient.
To register a new organisation:
OrganisationLocalType organisation = new OrganisationLocalType();
organisation.withStatus("active");
organisation.withOrganisationNature("WorldFederation");
// fill up all required data according to FIFA Data Standard
try {
String organisationFifaId = fifaConnectIdClient.registerOrganisation(organisation);
}
catch(UnauthorizedException ex){
// unauthorized
}
catch(AuthenticationException ex){
// invalid client credentials
}
catch (ValidationException ex) {
// validation error occurred
}
catch (FifaDuplicatedOrganisationFoundException ex) {
// organisation duplicates were found
List<OrganisationLocalType> duplicates = ex.getGetDuplicateOrganisationsResponseType().duplicates();
}
catch (InvalidClientDataException ex) {
// data sent to the service was invalid
BadRequestResponseType badRequest = ex.getBadRequestResponse();
}
catch (TooManyRequestsException ex) {
// call rate limit was exceeded
int retryAfterInSeconds = ex.getRetryAfter();
}
catch (FifaConnectIdException ex) {
// some other error occurred, see the details
ServiceResponse<Object> serviceResponse = ex.getServiceResponse();
}If duplicated organisation is found then FifaDuplicatedOrganisationFoundException will be thrown. In order to resolve conflict and register new organisation use optional force parameter as presented below:
boolean force = true;
String organisationFifaId = fifaConnectIdClient.registerOrganisation(organisation, force);To get the organisation data associated with the specified FIFA ID use getOrganisation method.
String organisationFifaId = "BVGE8TG";
try {
OrganisationLocalType organisation = fifaConnectIdClient.getOrganisation(organisationFifaId);
}
catch(AuthenticationException ex) {
// invalid client credentials
}
catch(UnauthorizedException ex) {
// unauthorized
}
catch (ValidationException ex) {
// validation error occurred
}
catch (InvalidClientDataException ex) {
// data sent to the service was invalid
BadRequestResponseType badRequest = ex.getBadRequestResponse();
}
catch (FifaEntityNotFoundException ex) {
// could not find the organisation
ServiceResponse<Object> serviceResponse = ex.getServiceResponse();
}
catch (FifaOrganisationMergedException ex) {
// requested organisation has been merged and is inactive
OrganisationLocalType organisation = (OrganisationLocalType) ex.getRequestedEntity();
String primaryOrganisationId = ex.getPrimaryEntityId();
}
catch (TooManyRequestsException ex) {
// call rate limit was exceeded
int retryAfterInSeconds = ex.getRetryAfter();
}
catch (FifaConnectIdException ex) {
// some other error occurred, see the details
ServiceResponse<Object> serviceResponse = ex.getServiceResponse();
}This method will throw FifaOrganisationMergedException when you try to get data for an organisation that has been previously merged and deactivated (refer to section 4.3 Merging/unmerging organisations). The exception will contain data about requested organisation together with primary organisation id.
To merge two organisations into a single one use mergeOrganisations method available on FifaConnectIdClient. This operation will only work for clubs. In addition you can only merge those that belong to the same Member Association that you are a member of. As a result of this operation, secondary organisation status will be set to inactive. This affects getting secondary organisation data in the future. Please refer to section 4.2 Getting organisation data. Here is an example how to merge organisations:
try {
OrganisationLocalType organisation = fifaConnectIdClient.mergeOrganisations(primaryOrganisationId, secondaryOrganisationId);
}
catch(AuthenticationException ex) {
// invalid client credentials
}
catch(UnauthorizedException ex) {
// unauthorized
}
catch (ValidationException ex) {
// validation error occurred
}
catch (InvalidClientDataException ex) {
// data sent to the service was invalid
BadRequestResponseType badRequest = ex.getBadRequestResponse();
}
catch (FifaConflictException ex) {
// a conflicting operation is currently in progress
ConflictResponseType response = ex.getResponse();
}
catch (FifaEntityNotFoundException ex) {
// could not find one of specified organisations
ServiceResponse<Object> serviceResponse = ex.getServiceResponse();
}
catch (TooManyRequestsException ex) {
// call rate limit was exceeded
int retryAfterInSeconds = ex.getRetryAfter();
}
catch (FifaConnectIdException ex) {
// some other error occurred, see the details
ServiceResponse<Object> serviceResponse = ex.getServiceResponse();
}In order to revert merge operation call unmergeOrganisations method with the same arguments.
To update the organisation data use updateOrganisation method.
String organisationId = "BVGE8TG";
try {
OrganisationLocalType organisation = fifaConnectIdClient.getOrganisation(organisationId);
// modify data
organisation.withStatus("inactive");
organisation.withEmail("some@other.email");
fifaConnectIdClient.updateOrganisation(organisation);
}
catch(AuthenticationException ex) {
// invalid client credentials
}
catch(UnauthorizedException ex) {
// unauthorized
}
catch (ValidationException ex) {
// validation error occurred
}
catch (InvalidClientDataException ex) {
// data sent to the service was invalid
BadRequestResponseType badRequest = ex.getBadRequestResponse();
}
catch (FifaEntityNotFoundException ex) {
// could not find the organisation
ServiceResponse<Object> serviceResponse = ex.getServiceResponse();
}
catch (FifaDuplicatedOrganisationFoundException ex) {
// organisation duplicates were found
List<OrganisationLocalType> duplicates = ex.getGetDuplicateOrganisationsResponseType().duplicates();
}
catch (TooManyRequestsException ex) {
// call rate limit was exceeded
int retryAfterInSeconds = ex.getRetryAfter();
}
catch (FifaConnectIdException ex) {
// some other error occurred, see the details
ServiceResponse<Object> serviceResponse = ex.getServiceResponse();
}If duplicated organisation is found then FifaDuplicatedOrganisationFoundException will be thrown. In order to resolve conflict and update organisation use optional force parameter.
findOrganisations method takes FindOrganisationsRequestType as a parameter that aggregates search criteria. It's possible to search by international and local names, parent organisation, organisation nature, address and last modification date.
SearchAddressType address = new SearchAddressType();
address.withCountry("ES");
address.withTown("Barcelona");
Calendar modifiedFromDate = Calendar.getInstance();
modifiedFromDate.add(Calendar.DATE, -30);
FindOrganisationsRequestType request = new FindOrganisationsRequestType();
request.withInternationalName("Barcelona");
request.withOfficialAddress(address);
request.withModifiedFromDateTime(DateTime.now(DateTimeZone.UTC).minusDays(5));
request.withModifiedToDateTime(DateTime.now(DateTimeZone.UTC));
request.withNumberOfResults(5);
try {
FindOrganisationsResponseType response = fifaConnectIdClient.findOrganisations(request);
List<FoundOrganisationLocalType> foundOrganisations = response.organisations();
}
catch (AuthenticationException ex) {
// invalid client credentials
}
catch (UnauthorizedException ex) {
// unauthorized
}
catch (InvalidClientDataException ex) {
// data sent to the service was invalid
}
catch (IOException ex) {
// exception thrown from serialization/deserialization
}
catch (ValidationException ex) {
// validation error occurred
}
catch (TooManyRequestsException ex) {
// call rate limit was exceeded
int retryAfterInSeconds = ex.getRetryAfter();
}
catch (FifaConnectIdException ex) {
// some other error occurred, see the details
ServiceResponse<Object> serviceResponse = ex.getServiceResponse();
}To get a list of duplicates for an organisation use getOrganisationDuplicates method. This method looks for similar organisations already registered in FIFA Connect ID Service.
OrganisationLocalType organisation = new OrganisationLocalType();
organisation.withStatus("active");
organisation.withInternationalName("Organisation name");
organisation.withOrganisationNature("Club");
// fill up all required data according to FIFA Data Standard
try {
List<OrganisationLocalType> foundDuplicates = fifaConnectIdClient.getOrganisationDuplicates(organisation);
}
catch (AuthenticationException ex) {
// invalid client credentials
}
catch (UnauthorizedException ex) {
// unauthorized
}
catch (ValidationException ex) {
// validation error occurred
}
catch (InvalidClientDataException ex) {
// data sent to the service was invalid
BadRequestResponseType badRequest = ex.getBadRequestResponse();
}
catch (TooManyRequestsException ex) {
// call rate limit was exceeded
int retryAfterInSeconds = ex.getRetryAfter();
}
catch (FifaConnectIdException ex) {
// some other error occurred, see the details
ServiceResponse<Object> serviceResponse = ex.getServiceResponse();
}To get a list with onboarded statuses (has any persons or suborganisations registered) for specific National Associations use getNationalAssociationsOnboardedStatus method. It takes NationalAssociationsOnboardedRequestType as a parameter which should contain list of strings with National Associations FIFA IDs.
ArrayList<String> nationalAssociationsFifaIds = new ArrayList<String>();
nationalAssociationsFifaIds.add("BVGE8TG");
NationalAssociationsOnboardedRequestType request = new NationalAssociationsOnboardedRequestType();
request.withNationalAssociationsFifaIds(nationalAssociationsFifaIds);
try {
NationalAssociationsOnboardedResponseType onboardedStatusResponse = fifaConnectIdClient.getNationalAssociationsOnboardedStatus(request);
}
catch (AuthenticationException ex){
// invalid client credentials
}
catch (IOException ex){
// exception thrown from serialization/deserialization
}
catch (UnauthorizedException ex) {
// unauthorized
}
catch (InvalidClientDataException ex) {
// provided organisation id is not valid
}
catch (FifaEntityNotFoundException ex) {
// could not find the organisation
}
catch (TooManyRequestsException ex) {
// call rate limit was exceeded
int retryAfterInSeconds = ex.getRetryAfter();
}
catch (FifaConnectIdException ex)
{
// some error occurred, see the details
}
catch (ValidationException ex) {
// validation error occurred
}To get a list with onboarded statuses for all National Associations use getAllNationalAssociationsOnboardedStatus method.
try {
NationalAssociationsOnboardedResponseType onboardedStatusResponse = fifaConnectIdClient.getAllNationalAssociationsOnboardedStatus();
}
catch (AuthenticationException ex){
// invalid client credentials
}
catch (IOException ex){
// exception thrown from serialization/deserialization
}
catch (UnauthorizedException ex) {
// unauthorized
}
catch (TooManyRequestsException ex) {
// call rate limit was exceeded
int retryAfterInSeconds = ex.getRetryAfter();
}
catch (FifaConnectIdException ex)
{
// some error occurred, see the details
}Some Member Associations may have a multi-level structure of children organisations, e.g. teams, clubs, schools, regions, etc. In many cases, however, there is a need to find out to which Member Association a given organisation (e.g. a club) belongs to. To get FIFA ID and short name of that Member Association use getMemberAssociationForFifaId method with the organisation's FIFA ID as input.
Note, that in order to retrieve the full name of the Member Association, call getOrganisation passing FIFA ID of the Member Association.
String uniqueFifaId = "BVGE8TG";
try {
MemberAssociationResponseType memberAssociation = fifaConnectIdClient.getMemberAssociationForFifaId(uniqueFifaId);
}
catch (FifaEntityNotFoundException ex) {
// could not find the memberAssociation
ServiceResponse<Object> serviceResponse = ex.getServiceResponse();
}
catch (UnauthorizedException ex) {
// unauthorized
}
catch (InvalidClientDataException ex){
// provided organisation id is not valid
}
catch (TooManyRequestsException ex) {
// call rate limit was exceeded
int retryAfterInSeconds = ex.getRetryAfter();
}
catch (FifaConnectIdException ex) {
// some other error occurred, see the details
ServiceResponse<Object> serviceResponse = ex.getServiceResponse();
}
catch (AuthenticationException ex) {
// invalid client credentials
}
catch (ValidationException ex) {
// validation error occurred
}All operations that refer to Facilities are performed using the FifaConnectIdClient.
To register a new facility:
FacilityLocalType facility = new FacilityLocalType();
facility.withStatus("active");
facility.withInternationalName("Wembley Stadium");
facility.withOrganisationFIFAId("BVGE8TG");
// fill up all required data according to FIFA Data Standard
try {
String facilityFifaId = fifaConnectIdClient.registerFacility(facility);
}
catch(AuthenticationException ex) {
// invalid client credentials
}
catch(UnauthorizedException ex) {
// unauthorized
}
catch (ValidationException ex) {
// validation error occurred
}
catch (FifaDuplicatedFacilityFoundException ex) {
// facility duplicates were found
List<FacilityLocalType> duplicates = ex.getGetDuplicateFacilityResponseType().duplicates();
}
catch (InvalidClientDataException ex) {
// data sent to the service was invalid
BadRequestResponseType badRequest = ex.getBadRequestResponse();
}
catch (TooManyRequestsException ex) {
// call rate limit was exceeded
int retryAfterInSeconds = ex.getRetryAfter();
}
catch (FifaConnectIdException ex) {
// some other error occurred, see the details
ServiceResponse<Object> serviceResponse = ex.getServiceResponse();
}If duplicated facility is found then FifaDuplicatedFacilityFoundException will be thrown. In order to resolve conflict and register new facility use optional force parameter.
To get the facility data associated with the specified FIFA ID:
String facilityFifaId = "105C40T";
try {
FacilityLocalType facility = fifaConnectIdClient.getFacility(facilityFifaId);
}
catch(AuthenticationException ex)
{
// invalid client credentials
}
catch(UnauthorizedException ex)
{
// unauthorized
}
catch (ValidationException ex) {
// validation error occurred
}
catch (InvalidClientDataException ex) {
// data sent to the service was invalid
BadRequestResponseType badRequest = ex.getBadRequestResponse();
}
catch (FifaEntityNotFoundException ex) {
// could not find the facility
ServiceResponse<Object> serviceResponse = ex.getServiceResponse();
}
catch (TooManyRequestsException ex) {
// call rate limit was exceeded
int retryAfterInSeconds = ex.getRetryAfter();
}
catch (FifaConnectIdException ex) {
// some other error occurred, see the details
ServiceResponse<Object> serviceResponse = ex.getServiceResponse();
}To update the facility data use updateFacility method.
String facilityId = "105C40T";
try {
FacilityLocalType facility = fifaConnectIdClient.getFacility(facilityId);
// modify data
facility.withStatus("inactive");
facility.withEmail("some@other.email");
fifaConnectIdClient.updateFacility(facility);
}
catch(AuthenticationException ex) {
// invalid client credentials
}
catch(UnauthorizedException ex) {
// unauthorized
}
catch (ValidationException ex) {
// validation error occurred
}
catch (InvalidClientDataException ex) {
// data sent to the service was invalid
BadRequestResponseType badRequest = ex.getBadRequestResponse();
}
catch (FifaEntityNotFoundException ex) {
// could not find the facility
ServiceResponse<Object> serviceResponse = ex.getServiceResponse();
}
catch (FifaDuplicatedFacilityFoundException ex) {
// facility duplicates were found
List<FacilityLocalType> duplicates = ex.getGetDuplicateFacilityResponseType().duplicates();
}
catch (TooManyRequestsException ex) {
// call rate limit was exceeded
int retryAfterInSeconds = ex.getRetryAfter();
}
catch (FifaConnectIdException ex) {
// some other error occurred, see the details
ServiceResponse<Object> serviceResponse = ex.getServiceResponse();
}If duplicated facility is found then FifaDuplicatedFacilityFoundException will be thrown. In order to resolve conflict and update facility use optional force parameter.
To search for a facility use findFacilities method. It takes FindFacilitiesRequestType as a parameter that aggregates search criteria. It's possible to search by international and local names, parent facility, organisation, and address.
SearchAddressType address = new SearchAddressType();
address.withCountry("ES");
address.withTown("Barcelona");
FindFacilitiesRequestType request = new FindFacilitiesRequestType();
request.withInternationalName("Camp Nou");
request.withOfficialAddress(address);
request.withNumberOfResults(5);
request.withModifiedFromDateTime(DateTime.now(DateTimeZone.UTC).minusDays(5));
request.withModifiedToDateTime(DateTime.now(DateTimeZone.UTC));
try {
FindFacilitiesResponseType response = fifaConnectIdClient.findFacilities(request);
List<FoundFacilityLocalType> foundFacilities = response.facilities();
}
catch (AuthenticationException ex) {
// invalid client credentials
}
catch (UnauthorizedException ex) {
// unauthorized
}
catch (InvalidClientDataException ex) {
// data sent to the service was invalid
}
catch (IOException ex) {
// exception thrown from serialization/deserialization
}
catch (ValidationException ex) {
// validation error occurred
}
catch (TooManyRequestsException ex) {
// call rate limit was exceeded
int retryAfterInSeconds = ex.getRetryAfter();
}
catch (FifaConnectIdException ex) {
// some other error occurred, see the details
ServiceResponse<Object> serviceResponse = ex.getServiceResponse();
}To get a list of duplicates for a facility use getFacilityDuplicates method. This method looks for similar facilities already registered in FIFA Connect ID service.
FacilityLocalType facility = new FacilityLocalType();
facility.withStatus("active");
facility.withInternationalName("Facility name");
// fill up all required data according to FIFA Data Standard
try {
List<FacilityLocalType> foundDuplicates = fifaConnectIdClient.getFacilityDuplicates(facility);
}
catch (AuthenticationException ex) {
// invalid client credentials
}
catch (UnauthorizedException ex) {
// unauthorized
}
catch (ValidationException ex) {
// validation error occurred
}
catch (InvalidClientDataException ex) {
// data sent to the service was invalid
BadRequestResponseType badRequest = ex.getBadRequestResponse();
}
catch (TooManyRequestsException ex) {
// call rate limit was exceeded
int retryAfterInSeconds = ex.getRetryAfter();
}
catch (FifaConnectIdException ex) {
// some other error occurred, see the details
ServiceResponse<Object> serviceResponse = ex.getServiceResponse();
}Transfer Matching System (TMS) is an online system facilitating international transfers of players. The FIFA Clearing House (FCH) is an entity acting as an intermediary for the payment of Training Rewards, i.e. Solidarity Contribution and Training Compensation.
Any Registration System who wants to satisfy the FCH requirements, needs to implement support for "FirstProRegistration", "ProofOfPayment" and "DomesticTransferDeclaration" messages. These messages are sent to TMS who further interacts with the FCH.
Please note, that this chapter focuses on the technical implementation only and does not give details about business scenarios that different methods should be used in. For the latter, check an article on our support portal.
When running the listener in a separate process, you need to provide a cache for incoming confirmation messages. Cache serves as shared storage for TMS responses received via Connect Service Bus. TmsFacade then utilizes it to check the executing operation status.
Instead of using the provided SDK's CorrelationIdBasedInMemoryCache<MessageReceived>, it is recommended that users establish their own storage solution for storing and retrieving incoming TMS responses.
Below are the interfaces that need to be implemented:
CorrelationIdBasedItemProvider<MessageReceived> - Used by the TMS facade to get records from cache by id. If there is no entry associated with the given id, null value should be returnedCorrelationIdBasedItemContainer<MessageReceived> - Used by the TMS message handlers factory to put records into the cacheThe simplest and most recommended method is to create one cache class that manages all types of TMS responses:
public class TmsResponsesCache implements CorrelationIdBasedItemContainer<MessageReceived>, CorrelationIdBasedItemProvider<MessageReceived> {
@Override
public void put(String correlationId, MessageReceived messageReceived) {
throw new NotImplementedException("Save to a shared storage");
}
@Override
public MessageReceived getByCorrelationId(String correlationId) {
throw new NotImplementedException("Retrieve from a shared storage");
}
}The TMS Facade relies on the registration facade to listen for incoming responses from TMS. It utilizes the same listener that receives personal details during person registration.
Furthermore, it is essential to pass the same instance of the responses cache class into the TMS message handlers as TMS facade. Otherwise, the facade will never be able to confirm the status of TMS operation.
In order to hook TMS facade into the existing listener infrastructure, you add new message handlers to the current listener:
Collection<MessageHandler> tmsMessageHandlers = TmsFacadeMessageHandlersFactory.createMessageHandlers(tmsResponsesCache);
messageHandlers.addAll(tmsMessageHandlers); // 2.4.2 Message handlersIn order to integrate with TMS, you need to instantiate a dedicated facade object that will serve as an entry point for all TMS-related operations.
final int pollingIntervalInMilliseconds = 50;
CachePollingResponseAwaitersFactory responseAwaitersFactory = new CachePollingResponseAwaitersFactory(pollingIntervalInMilliseconds);
TmsFacadeImpl tmsFacade = new TmsFacadeImpl(
registrationFacade.getServiceBusClient(), // 2.3 Using Registration Facade
logger, // 2.3.4 Logger
responseAwaitersFactory,
tmsResponsesCache); // 6.1.1 TMS responses cacheIn order to add a person to TMS, you need to build a PersonLocal object and pass it to addPlayer method. PersonLocal type is compliant with FIFA Data Standard. Please mind that property PersonFIFAId is obligatory.
String personFifaId = "<OBLIGATORY>";
PersonLocal personLocal = new PersonLocal();
personLocal.setPersonFIFAId(personFifaId);
//populate the person with data
try {
String correlationId = tmsFacade.addPlayer(personLocal);
} catch (TmsOperationException e) {
// Something went wrong
}Notice that in this scenario you don't wait for TMS to answer. correlationId does not prove that the message has been picked up by TMS, only that it has been successfully sent. Although correlationId is not required for any further processing, we recommend that you log it.
In order to update a person in TMS, you need to build a PersonLocal object and pass it to updatePlayer method. PersonLocal type is compliant with FIFA Data Standard. Please mind that property PersonFIFAId is obligatory.
String personFifaId = "<OBLIGATORY>";
PersonLocal personLocal = new PersonLocal();
personLocal.setPersonFIFAId(personFifaId);
//populate the person with data
try {
String correlationId = tmsFacade.updatePlayer(personLocal);
} catch (TmsOperationException e) {
// Something went wrong
}Notice that in this scenario you don't wait for TMS to answer. correlationId does not prove that the message has been picked up by TMS, only that it has been successfully sent. Although correlationId is not required for any further processing, we recommend that you log it.
TMS facade sends the declaration to the Service Bus. TMS is expected to read the declaration and send a Domestic Transfer Confirmation back with a TMS Transfer ID.
Once the confirmation is received you have to store the tmsTransferId. It will be required for sending Proof Of Payment message later on.
//create person local
final String personFifaId = "1XDZR79";
PersonLocal personLocal = new PersonLocal();
personLocal.setLocalLastName("ΧΑΡΑΛΑΜΠΟΥΣ");
personLocal.setGender(GenderType.MALE);
personLocal.setNationality(ISO3166CountryCode.CY);
personLocal.setDateOfBirth(dateOfBirth);
personLocal.setCountryOfBirth(ISO316613CountryCode.CY);
personLocal.setPlaceOfBirth("Larnaca");
personLocal.setLocalLanguage(ISO6392Type.GRE);
personLocal.setLocalCountry(ISO3166CountryCode.CY);
personLocal.setPersonFIFAId(personFifaId);
//add player registration
com.fifa.fc.PlayerRegistrationType transferRegistration = new com.fifa.fc.PlayerRegistrationType();
transferRegistration.setPersonFIFAId(personFifaId);
transferRegistration.setStatus(SimpleStatusType.ACTIVE);
transferRegistration.setOrganisationFIFAId("103C3AB");
transferRegistration.setRegistrationNature(PlayerRegistrationNatureType.REGISTRATION);
transferRegistration.setLevel(RegistrationLevelType.PRO);
transferRegistration.setDiscipline(DisciplineType.FOOTBALL);
transferRegistration.setRegistrationValidFrom(registrationValidFrom);
personLocal.getPlayerRegistrations().add(transferRegistration);
//create declaration
ClubType engagingClub = new ClubType();
engagingClub.setClubFIFAId("ARZI7RL");
engagingClub.setAssociationFIFAId("Q8ZZ8RT");
engagingClub.setInternationalLongName("Engaging Club International Name");
ClubType releasingClub = new ClubType();
releasingClub.setClubFIFAId("HNIUE01");
releasingClub.setAssociationFIFAId("SW8FJ2P");
releasingClub.setInternationalLongName("Releasing Club International Name");
DomesticTransferDeclaration declaration = new DomesticTransferDeclaration();
declaration.setMessageId("information uniquely identifying this particular declaration");
declaration.setPersonLocal(personLocal);
declaration.setEngagingClub(engagingClub);
declaration.setPlayerLevelInEngagingClub(RegistrationLevelType.PRO);
declaration.setReleasingClub(releasingClub);
declaration.setPlayerLevelInReleasingClub(RegistrationLevelType.AMATEUR);
declaration.setTransferNature(TransferNatureType.PERMANENT);
declaration.setContractEndDate(contractEndDate);
declaration.setSellOnFee(SellOnFeeType.NO);// if no information is available, set to SellOnFeeType.NOT_AVAILABLE
//add conditional transfer fees
ClubType recipientClub = new ClubType();
releasingClub.setClubFIFAId("HNIUE01");
releasingClub.setAssociationFIFAId("SW8FJ2P");
releasingClub.setInternationalLongName("Transfer Fee Club International Name");
TransferFeeDetailsType conditionalTransferFeeDetails = new TransferFeeDetailsType();
conditionalTransferFeeDetails.setAmount(BigDecimal.valueOf(123));
conditionalTransferFeeDetails.setRecipientClub(recipientClub);
conditionalTransferFeeDetails.setCurrency(ISO4217CurrencyCode.AED);
conditionalTransferFeeDetails.setDateOfPayment(dateOfPayment);
ConditionalTransferFeeType conditionalTransferFee = new ConditionalTransferFeeType();
conditionalTransferFee.setFeeDetails(conditionalTransferFeeDetails);
conditionalTransferFee.setCondition("specify condition");
declaration.getConditionalTransferFees().add(conditionalTransferFee);
//add fixed transfer fees
//add buyout release transfer fees
//populate the declaration with data
Duration timeout = Duration.ofSeconds(30);
try {
long tmsTransferId = tmsFacade.declareDomesticTransferAndWaitForTransferId(declaration, timeout);
} catch (DeclarationRejectedException declarationRejectedException) {
// TMS rejected the declaration. See the reason for details:
String rejectionReason = declarationRejectedException.getReason();
} catch (ResponseNotReceivedException responseNotReceivedException) {
// Possible reasons:
// 1. TMS has not responded within the timeout (consider increasing the timeout)
// 2. responsesSharedStorage is not populated by the listener
} catch (Exception e) {
// Something else went wrong
}The facade waits for a given period of time for the response. Should the response not arrive, ResponseNotReceivedException exception is thrown.
Should TMS consider the request invalid, DeclarationRejectedException will be thrown with a message from TMS providing the reason of the rejection.
In order to send a Proof of Payment to TMS, you need to build a ProofOfPayment object and pass it to provePaymentAndWaitForPaymentId method. Please mind that all properties are obligatory.
TMS facade sends the proof to the Service Bus. TMS is expected to read the proof and send a Proof Of Payment Confirmation back with a TMS Payment ID.
As of May 2024 there is no requirement to store tmsPaymentId. We recommend you log it as a confirmation that the message has been sent & received successfully.
ProofOfPayment proofOfPayment = new ProofOfPayment();
proofOfPayment.setMessageId("information uniquely identifying this particular payment, e.g. bank transfer id");
//populate all proof's properties
final Duration timeout = Duration.ofSeconds(30);
try {
long tmsPaymentId = tmsFacade.provePaymentAndWaitForPaymentId(proofOfPayment, timeout);
} catch (DeclarationRejectedException declarationRejectedException) {
// TMS rejected the declaration. See the reason for details:
String rejectionReason = declarationRejectedException.getReason();
} catch (ResponseNotReceivedException responseNotReceivedException) {
// Possible reasons:
// 1. TMS has not responded within the timeout (consider increasing the timeout)
// 2. responsesSharedStorage is not populated by the listener
} catch (Exception e) {
// Something else went wrong
}The facade waits for a given period of time for the response. Should the response not arrive, ResponseNotReceivedException exception is thrown.
Should TMS consider the request invalid, DeclarationRejectedException will be thrown with a message from TMS providing the reason of the rejection.
TMS facade sends the registration to the Service Bus. TMS is expected to read the registration and send a First Pro Registration Confirmation back with a TMS First Registration ID.
As of May 2024 there is no requirement to store tmsFirstRegistrationId. We recommend you log it as a confirmation that the message has been sent & received successfully.
PersonLocal personLocal = new PersonLocal();
// fill in required fields
com.fifa.fc.PlayerRegistrationType proRegistration = new com.fifa.fc.PlayerRegistrationType();
proRegistration.setPersonFIFAId(personLocal.getPersonFIFAId());
proRegistration.setStatus(SimpleStatusType.ACTIVE);
proRegistration.setOrganisationFIFAId("105C6FI");
XMLGregorianCalendar registrationValidFrom = DatatypeFactory.newInstance().newXMLGregorianCalendarDate(2021, 3, 31, DatatypeConstants.FIELD_UNDEFINED);
proRegistration.setRegistrationValidFrom(registrationValidFrom);
proRegistration.setLevel(RegistrationLevelType.PRO);
proRegistration.setDiscipline(DisciplineType.FOOTBALL);
proRegistration.setRegistrationNature(PlayerRegistrationNatureType.REGISTRATION);
personLocal.getPlayerRegistrations().add(proRegistration);
ClubType club = new ClubType();
club.setClubFIFAId("105KYBB");
club.setAssociationFIFAId("105C6FI");
club.setInternationalLongName("Club name");
FirstProRegistration firstProRegistration = new FirstProRegistration();
firstProRegistration.setMessageId("information uniquely identifying this particular registration");
firstProRegistration.setClub(club);
firstProRegistration.setPlayer(personLocal);
firstProRegistration.setClubStatus(ClubStatusType.ACTIVE);
firstProRegistration.setPlayerTrainedInOtherMemberAssociation(true);
final Duration timeout = Duration.ofSeconds(30);
try {
long tmsFirstRegistrationId = tmsFacade.declareFirstProRegistrationAndWaitForRegistrationId(firstProRegistration, timeout);
} catch (DeclarationRejectedException declarationRejectedException) {
// TMS rejected the declaration. See the reason for details:
String rejectionReason = declarationRejectedException.getReason();
} catch (ResponseNotReceivedException responseNotReceivedException) {
// Possible reasons:
// 1. TMS has not responded within the timeout (consider increasing the timeout)
// 2. responsesSharedStorage is not populated by the listener
} catch (Exception e) {
// Something else went wrong
}The facade waits for a given period of time for the response. Should the response not arrive, ResponseNotReceivedException exception is thrown.
Should TMS consider the request invalid, DeclarationRejectedException will be thrown with a message from TMS providing the reason of the rejection.
Certain business operations in FIFA Connect ID trigger notifications. For each notification type a subscription can be created, so that when a notification is triggered, then a message is sent out.
Two message types are supported: email & service bus. For the complete business documentation, list of notification types and methods to subscribe, please refer to Connect ID Notifications article.
In order to subscribe for a particular notification type, please get in touch with support.
Service bus messages are particularly interesting in the context of the SDK as it enables receiving them in an automated way. Under the hood, a service bus notification message is an XML document exchanged via the service bus infrastructure. The SDK handles the XML deserialization & validation and exposes an extension point you can hook into in order to process the message.
In order to use notification messages in your system, you need to implement an interface defined by the SDK and configure the listener to handle the messages.
In order to take advantage of notifications, additional message handlers must be added when configuring the listener. Custom business logic can be invoked by implementing a notification handler interface and passing it as a constructor parameter to the corresponding message handler.
A stub implementation of a custom notification message handler:
class CustomPersonMergedNotificationHandler implements PersonMergedNotificationHandler {
@Override
public void handle(PersonMergedNotification personMergedNotification) {
throw new NotImplementedException("Update your own Registration System database");
}
}To start handling the incoming notifications you need to add message handlers into current listener:
List<MessageHandler> notificationHandlers = List.of(
new PersonMergedMessageHandler(new CustomPersonMergedNotificationHandler()),
new PersonNameChangedMessageHandler(new CustomPersonNameChangedNotificationHandler()),
new GenderChangedMessageHandler(new CustomGenderChangedNotificationHandler()),
new DateOfBirthChangedMessageHandler(new CustomDateOfBirthChangedNotificationHandler()));
messageHandlers.addAll(notificationHandlers);This notification is created when a person ("secondary") is merged into another person ("primary"). The secondary person FIFA ID is no longer active.
With this notification message you can automate the process of updating your data. If you store any data for the secondary person, after the merge, you should replace the secondary person FIFA ID with the primary person FIFA ID in your Registration System.
The message contains the following information:
SDK exposes PersonMergedNotificationHandler interface which can be used to process a notification, e.g. update the FIFA ID in an internal Registration System's database.
This notification is created when a change of a person name is made using update. If you store any data for the person, after the change, you might want to update a record in your DB.
Due to the fact that ConnectId does not store persons' names, there is no information on what was the name before and after a change. To get new data of the modified record you can contact the Registration System that triggered the notification.
The message contains the following information:
SDK exposes PersonNameChangedNotificationHandler interface which can be used to process a notification.
This notification is created when a change of a person gender is made using update. If you store any data for the person, after the change, you might want to update a record in your DB.
The message contains the following information:
SDK exposes GenderChangedNotificationHandler interface which can be used to process a notification, e.g. update the person data in an internal Registration System's database.
This notification is created when a change of a person date of birth is made using update. If you store any data for the person, after the change, you might want to update a record in your DB.
The message contains the following information:
SDK exposes DateOfBirthChangedNotificationHandler interface which can be used to process a notification, e.g. update the person data in an internal Registration System's database.