Quick Question
|
|
I believe I must be missing something, I am trying to determine the person_id of the person logging into the API but I do not see any api methods that will return this. I would like to be able to take a username/password and pass it to the api to retrieve the person info for the person with that username. I looked through the ruby on rails wrapper as well as a number of the posts here but do not see anything helpful, am I missing something? Thank you for any help you can provide. |
|
|
Andrew, I wish I could tell you it’s easy, but it’s not. I’ve used a couple methods in the past, but the one that’s worked best (and the one we’re using now) is looping through all the companies returned from /contacts/companies/ and grabbing the ID of the one that doesn’t have canSeePrivate defined. Then looping through the contacts returned from contacts/companies/#COMPANY_ID, to find the one where the username matches (being sure to do a case-insensitive match). —Peter Rust |
|
|
Thanks for the reply Peter. This was the path I was heading down, but before I committed I wanted to make sure there wasn’t a more intuitive way to find that info. :) Thanks for confirming! |
|
|
Actually, for those of you reading this and trying to figure it out, there are a few tweaks that need to be made to Peter’s comment: 1. the node you need to look at is <can-see-private> It’s too bad that there is no other way to do this, it seems like a basic functionality the API should have. Ivan Periscope: Basecamp control in your iGoogle. http://periscopegadget.com/ |
|
|
In order to cut down on the number of times you need to make separate requests to the API during every process, I’ve taken to storing a minimal amount of information locally that mirrors the API, only items which doen’t change often, like projects, people and companies. Basically I just keep an information reference for this stored in mysql that will update itself whenever I make a call from an administration panel. I had to do this anyways in order to attach additional information to certain users, for example I wanted people to use their Basecamp login to access the system, but only certain people are allowed to access the system, so I needed to create a mysql table that had their user-id, and a flag indicating whether they could access the system, since it was convenient to do so, I also stored that person’s username in this table. I think the increase in efficiency (taking out the need for another XML transaction) is really worth it, even though you’re removing the single point of reference for your data, it’s not difficult to keep it in synch. |
|
|
I totally agree: Periscope using that same sequence to extract the person_id from the Basecamp API and then stores it locally in its own tables. That way, when a user needs to add time, if it doesn’t exist in the table, it just goes out to get it, and stores it. I’m all for caching data like person_id that won’t change over time—smart to do I think. Periscope: Basecamp control in your iGoogle. http://periscopegadget.com/ |
