<?php require_once '../../../../config.inc.php'; require_once '../../../../lib/functions/common.php'; require_once '../../../../third_party/redmine-php-api/lib/redmine-rest-api.php'; // $email = '*****@*****.**'; // $url = 'http://tl.m.redmine.org'; // $url = 'http://fman.m.redmine.org'; // $url = 'http://tl.m.redmine.org'; // $apiKey = 'b956de40bf8baf6af7344b759cd9471832f33922'; // $username = '******'; // $password = '******'; //$site = array(array('url' => 'http://192.168.1.174','apiKey' => 'e6f1cbed7469528389554cffcb0e5aa4e0fa0bc8'), // $site = array(array('url' => 'http://192.168.1.2','apiKey' => 'e6f1cbed7469528389554cffcb0e5aa4e0fa0bc8'), $site = array(array('url' => 'http://192.168.1.74', 'apiKey' => 'e6f1cbed7469528389554cffcb0e5aa4e0fa0bc8'), array('url' => 'http://tl.m.redmine.org', 'project_id' => 'tl-rest', 'apiKey' => 'b956de40bf8baf6af7344b759cd9471832f33922'), array('url' => 'http://127.0.0.1:8085/redmine', 'project_id' => 'fedora-20', 'apiKey' => '630e3a09b365757458c4039257f7ee57e87cec5d'), array('url' => 'https://127.0.0.1:8443/redmine', 'project_id' => 'fedora-20', 'apiKey' => '630e3a09b365757458c4039257f7ee57e87cec5d')); // e6f1cbed7469528389554cffcb0e5aa4e0fa0bc8 // curl -v -H "Content-Type: application/xml" -X POST --data "@issue.xml" -H "X-Redmine-API-Key: e6f1cbed7469528389554cffcb0e5aa4e0fa0bc8" http://192.168.1.2/issues.xml $targetSite = 1; $pxy = new stdClass(); $pxy->proxy = config_get('proxy'); var_dump($pxy); $red = new redmine($site[$targetSite]['url'], $site[$targetSite]['apiKey'], $pxy); echo 'Target Installation:' . $site[$targetSite]['url'] . '<br>'; $result = $red->getProjects(); var_dump($result);
<?php // TEST USING RAW redmine interface. // TestLink has a interface built using the RAW redmine interface require_once '../../../../third_party/redmine-php-api/lib/redmine-rest-api.php'; // 20140908 $site = array(array('url' => 'http://192.168.1.174', 'apiKey' => 'e6f1cbed7469528389554cffcb0e5aa4e0fa0bc8'), array('url' => 'http://tl.m.redmine.org', 'apiKey' => 'b956de40bf8baf6af7344b759cd9471832f33922'), array('url' => 'https://localhost:8443/redmine/', 'apiKey' => '81538efac88d05a1dbf77b80e793526dbd4921dd'), array('url' => 'http://localhost:8888/redmine/', 'apiKey' => '81538efac88d05a1dbf77b80e793526dbd4921dd'), array('url' => 'http://testlink01.m.redmine.org', 'apiKey' => '058157d55d62b632a665491abcc003aa4554673d')); // $siteID = 2; $siteID = 4; $issueID = 4; $red = new redmine($site[$siteID]['url'], $site[$siteID]['apiKey']); $issueObj = $red->getIssue($issueID); // echo '<pre>'; // var_dump($issueObj); // echo '</pre>'; // die(); echo '<br>'; echo 'Summary(SUBJECT):' . (string) $issueObj->subject . '<br>'; echo 'Status: Name/ID' . (string) $issueObj->status['name'] . '/' . (int) $issueObj->status['id'] . '<br>'; echo '<br><hr><pre>'; echo '</pre>'; echo '<br>'; echo 'Trying to add a NOTE'; $issueXmlObj = new SimpleXMLElement('<?xml version="1.0"?><issue></issue>'); $issueXmlObj->addChild('notes', htmlspecialchars('ciao Bello!!!')); $red->addIssueNoteFromSimpleXML($issueID, $issueXmlObj);
require_once '../../../../third_party/redmine-php-api/lib/redmine-rest-api.php'; // $email = '*****@*****.**'; // $url = 'http://tl.m.redmine.org'; // $url = 'http://fman.m.redmine.org'; // $url = 'http://tl.m.redmine.org'; // $apiKey = 'b956de40bf8baf6af7344b759cd9471832f33922'; // $username = '******'; // $password = '******'; //$site = array(array('url' => 'http://192.168.1.174','apiKey' => 'e6f1cbed7469528389554cffcb0e5aa4e0fa0bc8'), // $site = array(array('url' => 'http://192.168.1.2','apiKey' => 'e6f1cbed7469528389554cffcb0e5aa4e0fa0bc8'), $site = array(array('url' => 'http://192.168.1.74', 'apiKey' => 'e6f1cbed7469528389554cffcb0e5aa4e0fa0bc8'), array('url' => 'http://tl.m.redmine.org', 'project_id' => 'tl-rest', 'apiKey' => 'b956de40bf8baf6af7344b759cd9471832f33922'), array('url' => 'http://127.0.0.1:8085/redmine', 'project_id' => 'fedora-20', 'apiKey' => '630e3a09b365757458c4039257f7ee57e87cec5d'), array('url' => 'https://127.0.0.1:8443/redmine', 'project_id' => 'fedora-20', 'apiKey' => '630e3a09b365757458c4039257f7ee57e87cec5d')); // e6f1cbed7469528389554cffcb0e5aa4e0fa0bc8 // curl -v -H "Content-Type: application/xml" -X POST --data "@issue.xml" -H "X-Redmine-API-Key: e6f1cbed7469528389554cffcb0e5aa4e0fa0bc8" http://192.168.1.2/issues.xml $targetSite = 3; $red = new redmine($site[$targetSite]['url'], $site[$targetSite]['apiKey']); echo 'Target Installation:' . $site[$targetSite]['url'] . '<br>'; //var_dump($red); $issueObj = $red->getProjects(); //var_dump($issueObj); $issueNumber = 10; echo 'Getting ISSUE #' . $issueNumber . '<br>'; $issueObj = $red->getIssue($issueNumber); //var_dump($issueObj); echo '<br>'; echo 'Summary(SUBJECT):' . (string) $issueObj->subject . '<br>'; echo 'Status: Name/ID' . (string) $issueObj->status['name'] . '/' . (int) $issueObj->status['id'] . '<br>'; echo '<br><hr><pre>'; echo '</pre>'; $xml = new SimpleXMLElement('<?xml version="1.0"?><issue></issue>'); $xml->addChild('subject', htmlentities($site[$targetSite]['url'] . ' - TEST SUBJECT - rand:' . rand()));
<?php // TEST USING RAW redmine interface. // TestLink has a interface built using the RAW redmine interface require_once '../../../../third_party/redmine-php-api/lib/redmine-rest-api.php'; // 20140908 $site = array(array('url' => 'http://192.168.1.174', 'apiKey' => 'e6f1cbed7469528389554cffcb0e5aa4e0fa0bc8'), array('url' => 'http://tl.m.redmine.org', 'apiKey' => 'b956de40bf8baf6af7344b759cd9471832f33922'), array('url' => 'https://localhost:8443/redmine/', 'apiKey' => '81538efac88d05a1dbf77b80e793526dbd4921dd'), array('url' => 'http://localhost:8888/redmine/', 'apiKey' => '81538efac88d05a1dbf77b80e793526dbd4921dd')); $siteID = 2; $red = new redmine($site[$siteID]['url'], $site[$siteID]['apiKey']); $issueObj = $red->getIssue(3); // var_dump($issueObj); // die(); echo '<br>'; echo 'Summary(SUBJECT):' . (string) $issueObj->subject . '<br>'; echo 'Status: Name/ID' . (string) $issueObj->status['name'] . '/' . (int) $issueObj->status['id'] . '<br>'; echo '<br><hr><pre>'; echo '</pre>'; echo '<br>'; echo 'Trying to add a NOTE'; $issueXmlObj = new SimpleXMLElement('<?xml version="1.0"?><issue></issue>'); $issueXmlObj->addChild('notes', htmlspecialchars('ciao Bello!!!')); $red->addIssueNoteFromSimpleXML(3, $issueXmlObj);
<?php // TEST USING RAW redmine interface. // TestLink has a interface built using the RAW redmine interface require_once '../../../../third_party/redmine-php-api/lib/redmine-rest-api.php'; // 20140908 $site = array(array('url' => 'http://192.168.1.174', 'apiKey' => 'e6f1cbed7469528389554cffcb0e5aa4e0fa0bc8'), array('url' => 'http://tl.m.redmine.org', 'apiKey' => 'b956de40bf8baf6af7344b759cd9471832f33922'), array('url' => 'https://localhost:8443/redmine/', 'apiKey' => '81538efac88d05a1dbf77b80e793526dbd4921dd'), array('url' => 'http://localhost:8888/redmine/', 'apiKey' => '81538efac88d05a1dbf77b80e793526dbd4921dd'), array('url' => 'http://testlink01.m.redmine.org', 'apiKey' => '058157d55d62b632a665491abcc003aa4554673d')); $siteID = 4; $red = new redmine($site[$siteID]['url'], $site[$siteID]['apiKey']); $xml = new SimpleXMLElement('<?xml version="1.0"?><issue></issue>'); $xml->addChild('subject', htmlentities('TEST SUBJECT - MAY 1')); // As you see we can use the project identifier (string) as project_id!!! Great $xml->addChild('project_id', 'quantum-priv'); $xml->addChild('tracker_id', 1); $red->addIssueFromSimpleXML($xml);
<?php require_once '../../../third_party/redmine-php-api/lib/redmine-rest-api.php'; // $email = '*****@*****.**'; // $url = 'http://tl.m.redmine.org'; // $url = 'http://fman.m.redmine.org'; // $url = 'http://tl.m.redmine.org'; // $apiKey = 'b956de40bf8baf6af7344b759cd9471832f33922'; // $username = '******'; // $password = '******'; $site = array(array('url' => 'http://192.168.1.174', 'apiKey' => 'e6f1cbed7469528389554cffcb0e5aa4e0fa0bc8'), array('url' => 'http://tl.m.redmine.org', 'apiKey' => 'b956de40bf8baf6af7344b759cd9471832f33922')); $red = new redmine($site[0]['url'], $site[0]['apiKey']); $issueObj = $red->getIssue(3); echo '<br>'; echo 'Summary(SUBJECT):' . (string) $issueObj->subject . '<br>'; echo 'Status: Name/ID' . (string) $issueObj->status['name'] . '/' . (int) $issueObj->status['id'] . '<br>'; echo '<br><hr><pre>'; echo '</pre>'; die; /* 20120328 20:44 object(redmine)#1 (4) { ["url"]=> string(25) "http://fman.m.redmine.org" ["apiKey"]=> string(40) "b956de40bf8baf6af7344b759cd9471832f33922" ["curl"]=> resource(3) of type (curl) ["headers":"redmine":private]=> array(0) { } } /issues.xml?key=b956de40bf8baf6af7344b759cd9471832f33922 http://fman.m.redmine.org/issues.xml?key=b956de40bf8baf6af7344b759cd9471832f33922object(SimpleXMLElement)#2 (2) { ["@attributes"]=> array(4) { ["limit"]=> string(2) "25" ["type"]=> string(5) "array" ["total_count"]=> string(1) "1" ["offset"]=> string(1) "0" } ["issue"]=> object(SimpleXMLElement)#3 (14) { ["id"]=> string(1) "1" ["project"]=> object(SimpleXMLElement)#4 (1) { ["@attributes"]=> array(2) { ["name"]=> string(11) "fman-prj001" ["id"]=> string(1) "1" } }
<?php require_once '../../../third_party/redmine-php-api/lib/redmine-rest-api.php'; // $email = '*****@*****.**'; // $url = 'http://tl.m.redmine.org'; // $url = 'http://fman.m.redmine.org'; // $url = 'http://tl.m.redmine.org'; // $apiKey = 'b956de40bf8baf6af7344b759cd9471832f33922'; // $username = '******'; // $password = '******'; //$site = array(array('url' => 'http://192.168.1.174','apiKey' => 'e6f1cbed7469528389554cffcb0e5aa4e0fa0bc8'), // $site = array(array('url' => 'http://192.168.1.2','apiKey' => 'e6f1cbed7469528389554cffcb0e5aa4e0fa0bc8'), $site = array(array('url' => 'http://192.168.1.74', 'apiKey' => 'e6f1cbed7469528389554cffcb0e5aa4e0fa0bc8'), array('url' => 'http://tl.m.redmine.org', 'apiKey' => 'b956de40bf8baf6af7344b759cd9471832f33922')); // e6f1cbed7469528389554cffcb0e5aa4e0fa0bc8 // curl -v -H "Content-Type: application/xml" -X POST --data "@issue.xml" -H "X-Redmine-API-Key: e6f1cbed7469528389554cffcb0e5aa4e0fa0bc8" http://192.168.1.2/issues.xml $red = new redmine($site[0]['url'], $site[0]['apiKey']); $issueObj = $red->getIssue(3); var_dump($issueObj); die; echo '<br>'; echo 'Summary(SUBJECT):' . (string) $issueObj->subject . '<br>'; echo 'Status: Name/ID' . (string) $issueObj->status['name'] . '/' . (int) $issueObj->status['id'] . '<br>'; echo '<br><hr><pre>'; echo '</pre>'; $xml = new SimpleXMLElement('<?xml version="1.0"?><issue></issue>'); $xml->addChild('subject', htmlentities('TEST SUBJECT')); $xml->addChild('project_id', 'tl-rest'); $xml->addChild('tracker_id', 1); $red->addIssueFromSimpleXML($xml); /* What you get when things work ok