Introduction
Celoxis PHP API is an simple, easy to use yet comprehensive PHP library to interact with the Celoxis Project Management System. The library hides the underlying transport (HTTP) and data formats (XML/JSON) from the developer. The developer can now make simple PHP function calls to use the API. The PHP API is implemented in
CeloxisAPI class. But before you explore this class, take a look at the example later in this document.
Requirements
The Celoxis PHP API library requires the following :
PHP 5.1 or above
CURL module
JSON module
Example
The following sample code demonstrates how to use the API :
<?php
require_once('CeloxisAPI.php');
$api =
new CeloxisAPI("http://localhost:8888/psa/api.do");
try
{
//
// login
//
$api->login('mark', 'xxxxxxx', '12193391');
//
// Get all projects where percent complete is > 0 and manager_id is 29863
//
$rows = $api->query(array('table'=>'db_project', 'db_project.percent_complete.>' => 0, 'manager_id' => 29863));
foreach ($rows as $row)
{
echo 'id=' . $row['id'];
echo 'summary=' . $row['summary'];
echo '<br/>';
}
//
// Perform a custom query: get count of all projects by phases
// ONLY FOR INSTALLABLE CUSTOMERS
//
$api->query(array('table'=>'generic', 'sql'=>'select db_project_phase.name, count(*) from db_project,db_project_phase where db_project.phase_id=db_project_phase.id group by db_project_phase.name'));
//
// create a couple of users
//
$api->create("users", array(
array('first_name'=>'api fn 1', 'last_name'=>'api ln 1'),
array('first_name'=>'api fn 2', 'last_name'=>'api ln 2')
)
);
//
// create a project
//
$api->create("projects", array(
array('project_category_id'=> 7864,
'summary'=>'create by api 2',
'plan_start' => $api->encodeDate(2009, 6, 1),
'deadline' => $api->encodeDate(2009, 12, 31),
'manager_id' => 29863,
'client_id' => 29862)
)
);
}
{
$api->debugLastRequest();
}
?>
Documentation generated on Tue, 28 Jul 2009 06:00:03 +0000 by phpDocumentor 1.4.1