<?php /////////////////////////////////////// // Configuration part $test_server = 'http://' . $_SERVER['SERVER_ADDR'] . ':' . $_SERVER['SERVER_PORT']; $login = '******'; $password = '******'; $group_id = 101; $tracker_id = 123; $field_values = array(array('artifact_id' => 0, 'field_id' => 839, 'field_label' => '', 'field_value' => 'New artifact with summary only')); /////////////////////////////////////// try { $client_tracker_v5 = new SoapClient($test_server . '/plugins/tracker/soap/wsdl?wsdl', array('trace' => 1, 'exceptions' => 0, 'soap_version' => SOAP_1_1, 'cache_wsdl' => 0)); $client = new SoapClient($test_server . '/soap/codendi.wsdl.php?wsdl', array('trace' => 1, 'exceptions' => 0, 'soap_version' => SOAP_1_1, 'cache_wsdl' => 0)); $session = $client->login($login, $password); $session_hash = $session->session_hash; $user_id = $session->user_id; echo 'User ' . $login . ' (user_id=' . $user_id . ') is logged with session hash = ' . $session_hash . '<br>'; echo '<h1>Add an new artifact in tracker ' . $tracker_id . ' in project ' . $group_id . '</h1>'; echo '<h3>function addArtifact</h3>'; $art_id = $client_tracker_v5->addArtifact($session_hash, $group_id, $tracker_id, $field_values); var_dump($art_id); } catch (SoapFault $fault) { var_dump($fault); }
* the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * Tuleap is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with Tuleap. If not, see <http://www.gnu.org/licenses/>. */ // format : project_id tracker_id value if ($argc != 4) { die("Usage: " . $argv[0] . " project_id tracker_id summary\n"); } $serverURL = isset($_SERVER['TULEAP_SERVER']) ? $_SERVER['TULEAP_SERVER'] : 'http://sonde.cro.enalean.com'; $login = isset($_SERVER['TULEAP_USER']) ? $_SERVER['TULEAP_USER'] : '******'; $password = isset($_SERVER['TULEAP_PASSWORD']) ? $_SERVER['TULEAP_PASSWORD'] : '******'; $soapLogin = new SoapClient($serverURL . '/soap/?wsdl', array('cache_wsdl' => WSDL_CACHE_NONE)); // Establish connection to the server $requesterSessionHash = $soapLogin->login($login, $password)->session_hash; //save values $project_id = $argv[1]; $tracker_id = $argv[2]; $summary = $argv[3]; $value = array(array('field_name' => 'title', 'field_label' => 'title', 'field_value' => $argv[3]), array('field_name' => 'start', 'field_label' => 'start', 'field_value' => date("Y-m-d")), array('field_name' => 'end', 'field_label' => 'end', 'field_value' => date("Y-m-d"))); // Connecting to the soap's tracker client $soapTracker = new SoapClient($serverURL . '/plugins/tracker/soap/?wsdl', array('cache_wsdl' => WSDL_CACHE_NONE)); $value = array(array('field_name' => 'summary', 'field_label' => '', 'field_value' => array('value' => $summary)), array('field_name' => 'status_id', 'field_label' => '', 'field_value' => array('value' => 'To Be Done')), array('field_name' => 'is_related_to', 'field_label' => '', 'field_value' => array('value' => '41373'))); $response = $soapTracker->addArtifact($requesterSessionHash, $project_id, $tracker_id, $value); var_dump($response);