Repository navigation
Expand file tree
/
Copy pathREADME
More file actions
182 lines (157 loc) · 7.1 KB
/
Copy pathREADME
File metadata and controls
182 lines (157 loc) · 7.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
NAME:
Basecamp PHP API - A PHP class for access to the Basecamp REST API.
AUTHOR:
Monte Ohrt (monte [at] ohrt [dot] com)
LATEST VERSION:
1.1.1 - Aug 13, 2009
REQUIREMENTS:
PHP 5+
curl PHP extension
SimpleXML PHP extension (if simplexml is used as output)
SYNOPSIS:
// typical REST request
require('Basecamp.class.php');
$bc = new Basecamp('http://mysite.basecamphq.com/','myname','mypass');
$response = $bc->getProjects();
// see the XML output
print_r($response['body']);
// same request, but output is SimpleXML for easy PHP iteration
require('Basecamp.class.php');
$bc = new Basecamp('http://mysite.basecamphq.com/','myname','mypass','simplexml');
$response = $bc->getProjects();
// iterate the projects
foreach($response['body']->project as $project)
print_r($project);
// upload a file and attach to a new message
$file_id = $bc->uploadFile('./myfile.zip');
$response = $bc->createMessageForProject(
1234567,
'test title',
'test body',
null,
null,
0,
false,
array(),
array(array('My Zip File',$file_id,'application/zip','myfile.zip'))
);
// copy milestones and to-do's between projects
$bc->copyProject($from_project_id,$to_project_id);
DESCRIPTION:
Basecamp is a web service project manager found at http://www.basecamphq.com/.
Basecamp provides a REST API for developer access. Basecamp PHP API is a PHP
library that encapsulates all of the Basecamp API features into a simple to
use PHP class.
At this point there is not extensive documentation, as the code documents itself
very nicely :) You can choose the output of XML or SimpleXML, as seen in the
example above.
Each API method returns an array of values:
$response['body'] => the body of the response (xml or simplexml object)
$response['headers'] => the headers of the response
$response['status'] => the status of the response
$response['location'] => the location URL (if any)
$response['id'] => the new record id (if any)
The copyProject() method currently copies milestones and todo lists/items
from one project to another. Both projects must exist in Basecamp, you cannot
create projects through the API. All responsible parties and dates are
preserved.
FUNCTION LIST:
__construct ($baseurl,$username=null,$password=null,$format='xml')
getProjects()
getProject($project_id)
getMe($format=null)
getMyId()
getPeople()
getPeopleForProject($project_id,$format=null)
getPeopleIdsForProject($project_id)
getPeopleForCompany($company_id,$format=null)
getPeopleIdsForCompany($company_id)
getPerson($person_id)
getCompanies()
getCompaniesForProject($project_id,$format=null)
getCompanyIdsForProject($project_id)
getCompany($company_id)
getCategoriesForProject($project_id,$type='post',$format=null)
getCategoryIdsForProject($project_id,$type='post')
getCategory($category_id)
createCategoryForProject($project_id,$category_name,$type='post')
updateCategoryName($category_id,$category_name)
deleteCategory($category_id)
getMessagesForProject($project_id)
getMessage($message_id)
getMessagesForProjectForCategory($project_id,$category_id)
getArchivedMessageSummaryForProject($project_id)
getArchivedMessageSummaryForProjectForCategory($project_id,$category_id)
newMessageTemplateForProject($project_id)
createMessageForProject($project_id, $title, $body=null, $category_id=null, $extended_body=null, $milestone_id=0, $private=false, $notify_people=array(), $attachments=array())
uploadFile($filepath)
editMessage($message_id)
updateMessage($message_id, $title, $body=null, $category_id=null, $extended_body=null, $milestone_id=0, $private=false, $notify_people=array(), $attachments=array())
deleteMessage($message_id)
getRecentCommentsForResource($resource_type,$resource_id)
getRecentCommentsForMessage($message_id)
getRecentCommentsForMilestone($milestone_id)
getRecentCommentsForTodoItem($todo_id)
getComment($comment_id)
newCommentTemplateForResource($resource_type,$resource_id)
newCommentTemplateForMessage($message_id)
newCommentTemplateForMilestone($milestone_id)
newCommentTemplateForTodoItem($todo_id)
createCommentForResource($resource_type, $resource_id, $body)
createCommentForMessage($message_id, $body)
createCommentForMilestone($message_id, $body)
createCommentForTodoItem($message_id, $body)
editComment($comment_id)
updateComment($comment_id, $body)
deleteComment($comment_id)
getTodoListsForResource($resource_type,$resource_id=null)
getTodoListsForUnassigned()
getTodoListsForPerson($person_id)
getTodoListsForCompany($company_id)
getTodoListsForProject($project_id,$filter_type='all',$format=null)
getTodoListIdsForProject($project_id,$filter_type='all')
getTodoList($todo_list_id)
editTodoList($todo_list_id)
updateTodoList($todo_list_id, $name, $description=null, $milestone_id=null, $private=null, $tracked=null)
newTodoListTemplateForProject($project_id)
createTodoListForProject($project_id, $name, $description=null, $milestone_id=null, $private=null, $tracked=null)
deleteTodoList($todo_list_id)
reorderTodoListsForProject($project_id,$list_ids)
getTodoItemsForList($todo_list_id,$format=null)
getTodoItemIdsForList($todo_list_id)
getTodoItem($item_id)
completeTodoItem($item_id)
uncompleteTodoItem($item_id)
newTodoItemTemplateForList($todo_list_id)
createTodoItemForList($todo_list_id, $content, $responsible_party_type=null, $responsible_party_id=null, $notify=null)
updateTodoItem($todo_id, $content, $responsible_party_type=null, $responsible_party_id=null, $notify=null)
editTodoItem($todo_id)
deleteTodoItem($todo_id)
reorderTodoItemsForList($todo_list_id,$todo_ids=array())
getMilestonesForProject($project_id,$filter_type='all')
completeMilestone($milestone_id)
uncompleteMilestone($milestone_id)
createMilestoneForProject($project_id, $title, $deadline, $responsible_party_type=null, $responsible_party_id=null, $notify=null)
updateMilestone($milestone_id, $title, $deadline, $responsible_party_type=null, $responsible_party_id=null, $notify=null)
deleteMilestone($milestone_id)
getTimeEntriesForProject($project_id,$page=0)
getTimeEntriesForTodoItem($todo_id,$page=0)
createTimeEntryForProject($project_id, $person_id, $date, $hours, $description=null)
createTimeEntryForTodoItem($todo_id, $person_id, $date, $hours, $description=null)
getTimeEntry($entry_id)
editTimeEntry($entry_id)
updateTimeEntry($entry_id, $person_id, $date, $hours, $description=null)
deleteTimeEntry($entry_id)
getTimeEntryReport($from=null, $to=null, $subject_id=null, $to_item_id=null, $filter_project_id=null, $filter_company_id=null)
getUsername()
setUsername($username)
getFormat()
setFormat($format)
getPassword()
setPassword($password)
getBaseurl()
setBaseurl($url)
OTHER PROJECTS:
View my other projects at http://www.phpinsider.com/.
Happy coding.
Monte