Skip to content
spekkionu edited this page May 14, 2012 · 2 revisions

Full api documentation of BugHerd API can be found at http://www.bugherd.com/api

List Users

Returns an array of BugHerd_User objects.

$api = new BugHerd_Api('email@example.com', 'password');
$users = $api->listUsers();

List Projects

Returns an array of BugHerd_Project objects.

$api = new BugHerd_Api('email@example.com', 'password');
$projects = $api->listProjects();

Show Project

Returns a BugHerd_Project object with project details.

$api = new BugHerd_Api('email@example.com', 'password');
$projects = $api->showProject($project_id);

Create Project

Creates a new project

$api = new BugHerd_Api('email@example.com', 'password');
$project = new BugHerd_Project();
$project->name = 'Project name';
$project->devurl = 'http://www.project-url.com';
$project = $api->createProject($project);

Update Project

Updates an existing project

$api = new BugHerd_Api('email@example.com', 'password');
$project = $api->showProject($project_id);
$project->name = 'New project name';
$project->devurl = 'http://www.new-project-url.com';
$project->active= false;
$api->updateProject($project_id, $project);

Delete Project

Deletes an existing project. Also deletes all tasks and comments for that project.

$api = new BugHerd_Api('email@example.com', 'password');
$api->deleteProject($project_id);

List Tasks

Returns tasks for a project. Returns array of BugHerd_Task objects.

$api = new BugHerd_Api('email@example.com', 'password');
$tasks = $api->listTasks($project_id);

Show Task

Returns BugHerd_Task object.

$api = new BugHerd_Api('email@example.com', 'password');
$task = $api->showTask($project_id, $task_id);

Create Task

Returns BugHerd_Task object.

$api = new BugHerd_Api('email@example.com', 'password');
$task = new BugHerd_Task();
$task->description = 'Task description';
$task->priority = BugHerd_Task::PRIORITY_IMPORTANT;
$task = $api->createTask($project_id, $task);

Update Task

Returns BugHerd_Task object.

$api = new BugHerd_Api('email@example.com', 'password');
$task = $api->showTask($project_id, $task_id);
$task->description = 'New task description';
$task->priority = BugHerd_Task::PRIORITY_CRITICAL;
$task->status = BugHerd_Task::STATUS_DOING;
$api->updateTask($project_id, $task_id, $task);

List Comments

Returns array of BugHerd_Comment objects

$api = new BugHerd_Api('email@example.com', 'password');
$comments = $api->listComments($project_id, $task_id);

Show Comment

Returns BugHerd_Comment object

$api = new BugHerd_Api('email@example.com', 'password');
$comment = $api->showComment($project_id, $task_id, $comment_id);

Create Comment

Returns BugHerd_Comment object

$api = new BugHerd_Api('email@example.com', 'password');
$comment = new BugHerd_Comment();
$comment->test = 'Comment text';
$comment = $api->createComment($project_id, $task_id, $comment_id, $comment);