The Rest API is the new and better way to get data from us. It is faster, more reliable and easier to use.
The Rest API is located at /app/docs and is the preferred way to get data from us.
The same application key is used for both the Rest API and the Soap API.
If you have access to it, you should start with getTournaments to get a list of tournaments. Use the parameters to find a tournament within a date range, etc. Take notice of the 'Tournament id'. You will need it!
There are a lot of services, and you don't need to run them all the time, as this will take a lot of resources from our servers.
The arenas, clubs, fields, matchclasses and matchteams does not change often. Mostly you will only need to download this information once. But how can you really be sure that this informasjon is correct? You should use getTournamentMatchStatus regularly to check this.
From 2015, the id's of matches, matchclasses and matchteams does not change when a match etc is updated from the TX client program!! This is good news, as you don't have to reload all the information. You only need to keep the date and time when you last checked getTournamentMatchStatus, and you use that time as input parameter to check if there are any changes.
During a tournament, the matches will be continuously updated from the TX client. This means that you need to check regularly with the API to know if any matches are either deleted, updated or have been created. If, for instance, a team has dropped out in the last moment, the matches for that team might be removed and new matches created for the teams they were supposed to meet.
getTournamentMatchStatus will inform you if you need to fetch nothing, something or everything. If you run this check every 10 minutes, you should keep the datetime of your last check, and use that as input parameter for the next check. Then you will know what data has changed the last 10 minutes.
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:for="https://www.profixio.com/soap/tournament/ForTournamentExt.php">
<soapenv:Header/>
<soapenv:Body>
<for:getTournamentMatchStatus>
<application_key>secret_key</application_key>
<tournamentID>11116</tournamentID>
<since>2014-11-25 12:16:00</since>
</for:getTournamentMatchStatus>
</soapenv:Body>
</soapenv:Envelope>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="https://www.profixio.com/soap/tournament/ForTournament.php">
<SOAP-ENV:Body>
<ns1:getTournamentMatchStatusResponse>
<getTournamentMatchStatusResult>
<needTotalRefresh>false</needTotalRefresh>
<existsNewOrUpdatedMatches>false</existsNewOrUpdatedMatches>
<existsDeletedMatches>false</existsDeletedMatches>
<matchesCount>9</matchesCount>
<teamCount>19</teamCount>
<DeletedMatches/>
</getTournamentMatchStatusResult>
</ns1:getTournamentMatchStatusResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
The most important return parameter is needTotalRefresh
.
needTotalRefresh
is TRUE
:
Then you must refresh all matches, matchclasses, teams etc. Because the information has been deleted
from the web database, and all the information on the web has been thrown away. This includes the id's.
At this stage the tournament owner might not have anything at all on the web database.
Tip: Check the matchesCount
and teamCount
parameters to see if there is data to fetch from the API.If needTotalRefresh
is FALSE
:
Then you don't need to update everything. The id's on the matches etc are fine. But some matches might have
new results, or may have been moved to other classes.
Then existsNewOrUpdatedMatches
will show if there are new/updated matches.
If there are new or updated matches, run getMatches with the since
parameter
to get the new and updated matches. We are timestamping all changes to matches, so that using the since
input
parameter to fetch from getMatches will both get the new and the updated matches.
Deleted matches:
If needTotalRefresh
is FALSE
and a match has been deleted, a list with id's of the deleted match(es) will
be included in getTournamentMatchStatus.
See getTournamentMatchStatus for more information.
We try getTournamentMatchStatus
on a live tournament:
<?php
$url = "https://www.profixio.com/soap/tournament/ForTournamentExt.php?wsdl";
$param = array(
"application_key" => '**your**password***',
"tournamentID" => "11116",
"since" => "2014-11-20 08:51"
);
try {
$soap = new SoapClient($url);
$result = $soap->getTournamentMatchStatus($param); // Method name here!
echo "<pre>" . print_r($result, true) . '</pre>';
} catch (SoapFault $exc) {
echo "<p><h2>SoapFault</h2>";
echo "<p><b>" . $exc->getMessage();
";
}
And the result is:
[getTournamentMatchStatusResult] => stdClass Object
(
[needTotalRefresh] => false // <- Most important to check this !!!
[existsNewOrUpdatedMatches] => true // Any new or updated matches? Fetch with getMatches()
[existsDeletedMatches] => true // Any deleted matches? They are included below.
[matchesCount] => 9 // <- Total number of matches that exists in the tournament (not deleted ones)
[teamCount] => 19 // <- Total number of teams that exists in the tournament
[DeletedMatches] => stdClass Object
(
[item] => Array
(
[0] => stdClass Object
(
[id] => 27924663 // -> match id of the deleted match
[matchTXID] => 100 // TX id shouldn't be needed anymore, but if you need it...
[matchno] => 100
)
[1] => stdClass Object
(
[id] => 27924662
[matchTXID] => 101
[matchno] => 101
)
The Rest API is the new and better way to get data from us. It is faster, more reliable and easier to use.
The Rest API is located at /app/docs and is the preferred way to get data from us.
The same application key is used for both the Rest API and the Soap API.
Returns arenas used in a tournament @param string $application_key @param int $tournamentID @param int $limit (optional) @param string $timestamp_since (optional) Search for rows updated after the specified datetime. The format is: YYYY.MM.DD HH:MM:SS(e.x. 2014-06-24 00:00:00 ) @return Arena[]
Returns clubs that have teams playing matches in a tournament @param string $application_key @param int $tournamentID @param int $limit (optional) @return TournamentClub[]
Returns fields used in a tournament @param string $application_key @param int $tournamentID @param string $arenaID (optional) @param int $limit (optional) @param string $timestamp_since (optional) Search for rows updated after the specified datetime. The format is: YYYY.MM.DD HH:MM:SS(e.x. 2014-06-24 00:00:00 ) @return Field[]
Returns match classes and match groups in a tournament The period length and number of periods can be overriden at the match-level. Often, playoff matches are longer than regular matches. @param string $application_key @param int $tournamentID @return MatchClass[]
Returns matches in a tournament Use the optional search parameters to restrict the search. @param string $application_key @param int $tournamentID @param string $classID (optional) @param string $groupID (optional) @param string $matchID (optional) @param string $endplay (optional) 1=search for endplay (sluttspill) @param string $since (optional) Search for rows updated after the specified datetime. The format is: YYYY.MM.DD HH:MM:SS(e.x. 2014-06-24 00:00:00 )* @param int $limit (optional) @param string $matchTXID (optional) This is the match id used in TX, and is unique for a match in a tournament. It will not change. @throws SoapFault @return TournamentMatch[]
Returns tables in a tournament @param string $application_key @param int $tournamentID @param string $groupID (optional) @param string $playoffID (optional) Use matchclassID to get tables playoffs @param string $teamID (optional) @param string $language (optional) @param string $playoffLevel (optional) 1 is playoff A, 2 is playoff B. @return MatchTable[]
Returns teams that play matches in a tournament @param string $application_key @param int $tournamentID @param int $clubID (optional) Refers to TournamentClub.id @param int $limit (optional) @param int offset (optional) @param string $timestamp_since (optional) Search for rows updated after the specified datetime. The format is: YYYY.MM.DD HH:MM:SS(e.x. 2014-06-24 00:00:00 ) @return TournamentTeam[]
Use getTournamentMatchStatus to check if the matches have been updated for the tournament. Scenario 1: Total refresh If the whole match schedule has been updated/deleted for the tournament, you will have to fetch all teams, match classes, match groups etc. Scenario 2: Deleted match One or more match has been deleted: Then getTournamentMatchStatus will return the MatchID's for the deleted matches. Scenario 3: New or updated match When there are new or updated matches, use the getMatches function with the same "since"-parameter to get the new and updated matches. @param string $application_key @param int $tournamentID @param string $since @return TournamentMatchStatus @throws SoapFault
Returns details for existing tournaments @param string $application_key @param string $countryCode (optional) @param string $sport (optional) @param string $fromDate (optional) If empty, it searches 2 months back. Search for tournaments with startdate => fromDate. The dateformat is: YYYY.MM.DD (e.x. 2014-06-24 ) @param string $timestamp_since (optional) Search for rows updated after the specified datetime. The format is: YYYY.MM.DD HH:MM:SS(e.x. 2014-06-24 00:00:00 ) @return Tournament[]
To use the Profixio API from a 3rd party application there are several layers of access.
Every user of our SOAP API is required to get an Application Key from Profixio. This key allows give access to different data.
For example, you can be given access to data from:
<?php
$url = "https://www.profixio.com/soap/services/setMatchResult.php?wsdl";
# If accesslevel 3:
$param = array(
"application_key" => "secret", // contact us for your access key!
"matchID" => 30614758,
"team1Goals" => 2,
"team2Goals" => 3,
);
# If accesslevel 2
$param = array(
"application_key" => "secret", // contact us for your access key!
"username " => "[email protected]",
"password " => "myPazzw0rd",
"matchID" => 30614758,
"team1Goals" => 2,
"team2Goals" => 3,
);
try {
$soap = new SoapClient($url);
$result = $soap->setMatchResult($param);
echo "Result: <pre>";
print_r($result);
echo "</pre>";
} catch (SoapFault $exc) {
echo $exc->getMessage();
echo $exc->getCode();
}
?>
<?php
$url = "https://www.profixio.com/soap/tournament/ForTournament.php?wsdl";
// Parameters for the getClubs method
$param = array(
"application_key" => "something secret", // contact us for your access key!
"tournamentID" => "999", // Your tournament id
"limit" => "3",
);
try {
$soap = new SoapClient($url);
$result = $soap->getClubs($param);
echo "Result: <pre>";
print_r($result);
echo "</pre>";
} catch (SoapFault $exc) {
echo $exc->getMessage();
echo $exc->getCode();
}
?>