Basecamp: PHP Class In Progress - Feedback Needed

I have begun working on a Basecamp PHP class (using cURL). I can certainly add in many of the basics, but I would love some feedback as to what YOU would like it to do. So, please write comments with ideas/wishlist of features that you would like to see in a Basecamp PHP class.

At this point (not *quite* ready for a release), you pass the object your url and login credentials to create the object. From that point, you can get information very easily on people, projects, messages, todos, etc. (returned as an xml object) from which you can sort through to find the data you need.

I haven’t yet created the functionality to post data - but that won’t be difficult, as I already know how to do it.

I’ll hope to have a release within the next couple weeks (hopefully). I’ll create a static page for it similar to my Magento Product Import Script.

Update (11.16.08 - 9pm): I have the class successfully posting comments (to any resource), and posting new messages is in the works. Notifications and file attachments are also on the works.

Update (11.16.08 - 11:20pm): Successfully posting messages to any given project id, category id, and you can easily set if a message is private or not.

16 Comments

ErinNovember 24th, 2008 at 4:08 pm

How about posting milestones? Better yet, how about posting a milestone, then a message and associating the milestone to the message?

Josh PrattNovember 24th, 2008 at 5:42 pm

Erin,

Yes - Milestones are on the list for the next release.

In regards to posting a message associated with the milestone, I can create the post_milestone method return the resource_id, or have that method store the resource_id into a variable which can be retrieved. Then, you can just call the post_message function and make sure you’ve given it the resource_id, thus it would then post your message to that milestone.

jeffDecember 3rd, 2008 at 12:41 pm

I see on twitter you’ve got file attachments working! When do you think you will get around to posting an update?

Josh PrattDecember 3rd, 2008 at 12:45 pm

Jeff,

I should post one soon. I’ve been waiting for 37 signals to get back to me on something. I’ve noticed that when posting messges, comments, to-do lists and items, I don’t get an XML response back - which complicates the code.

Perhaps I can just figure out a work-around for now. I’ll plan on a release within a week hopefully. I think I’ll have some time to do it on Thursday. We’ll see.

ErinDecember 3rd, 2008 at 3:25 pm

Hi again,

I have your class working (yay!) for posting new messages, but I am struggling with updating an existing message. Will you include updates (rather than new posts) in your class?

Thanks!

Josh PrattDecember 3rd, 2008 at 3:35 pm

Erin,

Fantastic! Yes - I don’t have any methods for updating anything yet. I will include updating messages in the next release! Thanks for the feedback.

Michael RichardsonDecember 3rd, 2008 at 5:13 pm

Hello everyone. I’m happy to see Josh working on this. I’m having mixed luck. Can’t seem to post messages. When anyone has a working chunk of code (assuming the class and basic declarations) that’d be great.

@Erin — can you post what you did to get message posting to work?

Josh PrattDecember 3rd, 2008 at 5:16 pm

Michael,

The class should be functional - I and Erin have it working. I’ll write you an email.

jeffDecember 3rd, 2008 at 5:37 pm

I have it working as well for posting messages. Just anxiously waiting for attachments!

Michael RichardsonDecember 3rd, 2008 at 6:05 pm

Thanks Josh — Got it working once I removed the default category-id from post_message(). Anyone know how to query for one’s (unique) list of categories?

Michael RichardsonDecember 3rd, 2008 at 7:13 pm

Whoops… XML tags got stripped out….

Josh PrattDecember 4th, 2008 at 12:01 am

Michael,

Ahh - good catch on the category id’s. I will try and put together a function to gather that - as well as a generic function to manually set it as well. Thanks!

Jeff,

They are coming! Hopefully sometime by Thursday night (Dec. 4th.)

ErinDecember 4th, 2008 at 10:46 am

We are anxiously waiting.

GeorgeDecember 12th, 2008 at 2:33 pm

I read in your code:
[code] * Note: I have found that only Milestones, File Attachments, and Time-Tracking posts
* return an XML response. Messages, Comments, and To-Dos do not send back an XML response.
* This makes it difficult because for those three resources that do NOT send back an XML
* response, I have to pull the new data (new resource id) from the header instead, creating
* two distinct methods. I have contacted 37 signals about this, and I’m still waiting for
* a response. So, at this time, when posting Messages, Comments, or To-Dos, there is no
* ID returned.
[/code]
Dunno if this helps you, but an idea:
I got the headers from the curl request reply using Sean Huber’s Curl wrapper: http://github.com/shuber/curl/
and then preg_replace’ing the last chars of:
$response->headers['Location']

Josh PrattDecember 12th, 2008 at 2:37 pm

George,

Thanks for the comment. That stuff is going to be complete fixed and not an issue with the release of 1.2 - which I hope will be released sometime next week. Thanks!

Michael NassDecember 17th, 2008 at 11:48 am

Josh,

Great work on this. Thanks a ton!

Curious if you’ve heard anything back from 37Signals on the XML response from Messages, etc… Seems odd that they don’t return anything.

I’m working on something with your class so was really hoping to have 1.2 but it looks like I’ll have to go use the curl request reply method you mentioned as this work is due end of week.

Just wanted to encourage you. I really appreciate what you’re doing. Ever need help, let me know :)

Leave a comment

Your comment