1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
| <?php
// Instanciate new SOAP Client
$soap = new SoapClient('http://blablaa.com/soap/index.php?wsdl');
// Call 'login' to retreive an authentication token
$hash = $soap->login('user', 'pwd')->session_hash;
$arrayOfGroups = $soap->getMyProjects($hash);
foreach ($arrayOfGroups as $group) {
echo 'Project id: '.$group->group_id.PHP_EOL;
echo 'Project name: '.$group->group_name.PHP_EOL;
echo 'Project unix name: '.$group->unix_group_name.PHP_EOL;
echo 'Project description: '.$group->description.PHP_EOL;
echo '--------'.PHP_EOL;
}
// Get the first project
if (isset($arrayOfGroups[0])) {
$group = $arrayOfGroups[0];
$arrayOfTrackers = $soap->getArtifactTypes($hash, $group->group_id, array(), 0, 1);
// If there is at least one tracker, take the first one
if (isset($arrayOfTrackers[0])) {
$tracker = $arrayOfTrackers[0];
echo 'First tracker of '.$group->group_name.' project is "'.$tracker->item_name.'"'.PHP_EOL;
}
}
// Cancel session
$soap->logout($hash);
?> |
Partager