Starting point for php API?

Discussion and information for XML-RPC interface.

Moderators: Amaradana, TurboPT, TL Developers

Starting point for php API?

Postby tfeathers » Tue May 05, 2009 8:14 pm

I need a doc to walk me through how to even start getting the API to work. I still can't find the sample client code... Anyone that can help me?
tfeathers
Advanced user
 
Posts: 19
Joined: Thu Mar 19, 2009 1:19 pm

Postby fman » Wed May 06, 2009 10:42 am

have you browsing your TL installation?
see inside lib\api\ folder
fman
Member of TestLink Community
 
Posts: 3088
Joined: Tue Nov 15, 2005 7:19 am

Postby tfeathers » Wed May 06, 2009 1:46 pm

Thank you very much. Now I have a question about the php scripts? When I run them from command line on my location machine. I get IXR_Client not found. Am I missing something on my php install? Should these script be run on the server where testlink is installed?
tfeathers
Advanced user
 
Posts: 19
Joined: Thu Mar 19, 2009 1:19 pm

Postby fman » Wed May 06, 2009 4:03 pm

you need to have part of TL installation i.e. XML-RPC library
fman
Member of TestLink Community
 
Posts: 3088
Joined: Tue Nov 15, 2005 7:19 am

Postby tfeathers » Wed May 06, 2009 4:47 pm

Isn't that taken care of by the require statement?
require_once dirname(__FILE__) . THIRD_PARTY_CODE . '/xml-rpc/class-IXR.php';
tfeathers
Advanced user
 
Posts: 19
Joined: Thu Mar 19, 2009 1:19 pm

Postby fman » Thu May 07, 2009 10:35 am

yes but you have to have this ON HOST from where you are trying to run client
fman
Member of TestLink Community
 
Posts: 3088
Joined: Tue Nov 15, 2005 7:19 am

Postby tfeathers » Thu May 07, 2009 3:21 pm

Thank you very much. It is all working now. Is there a way for me to use php -a <scriptname>.php to only print out the data I need to the command line?

For example,

$args["testplanid"]='7';
$args["testcaseexternalid"]='Test-2';

$debug=true;
echo $unitTestDescription;
$client = new IXR_Client($server_url);
$client->debug=$debug;

new dBug($args);
if(!$client->query("tl.{$method}", $args))
{
echo "something went wrong - " . $client->getErrorCode() . " - " . $client->getErrorMessage();
$response=null;
}
else
{
$response=$client->getResponse();
}

I want to parse $response as a string and get the date I need. Not print it out using new dBug($response);
tfeathers
Advanced user
 
Posts: 19
Joined: Thu Mar 19, 2009 1:19 pm

Postby fman » Thu May 07, 2009 4:28 pm

comment out dBug() calls
in anyway examples are thinked to be runned NOT FROM COMMAND LINE
and I've never tested it in this condition
fman
Member of TestLink Community
 
Posts: 3088
Joined: Tue Nov 15, 2005 7:19 am


Return to XML-RPC API



Who is online

Users browsing this forum: No registered users and 4 guests