1133: API to obtain the logged in user's name.

diwake******@gmai***** (Google Code) (Is this you? Claim this profile.)
chipx86
chipx86
June 14, 2010
board.org/


What version are you running?
1.0 beta2.

What's the URL of the page this enhancement relates to, if any?
NA.

Describe the enhancement and the motivation for it.
I'm trying to write a script that closes (marks as submtited) all of my
review requests that have been marked "ship it". I went through the JSON
API but I'm at a loss to find a call that either gives me all the review
requests for the logged in user, or some easy way to obtain the username of
the logged in user first and then use that to get the list of review
requests. I also looked at the code of post-review.py and it seems that if
you already have a valid cookie, there is no good way to determine the
username for the logged in user, and I don't want to have to manually
specify my username each time.

What operating system are you using? What browser?
Linux (Ubuntu 9.04). Firefox 3.0.8.

Please provide any additional information below.
chipx86
#1 chipx86
Won't make it for 1.0, but should be doable for 1.1. If you can provide a patch
against SVN, that will ensure it'll get in.
  • +Confirmed
  • +Milestone-Release1.1
    +Component-API
chipx86
#2 chipx86
  • +Milestone-Release1.5
chipx86
#3 chipx86
The API in 1.0.x supports this through
/api/json/reviewrequests/from/user/<username>/, and the new one in 1.5 will support
this through /api/review-requests/?from-users=<username>
  • -Confirmed
    +Fixed
  • +chipx86
#4 diwake******@gmai***** (Google Code) (Is this you? Claim this profile.)
I'm aware of this API. However, the problem is calling this API without having to 
specify the username. Consider this concrete example. Say I want to extend post-
review to list all of my unsubmitted reviews:

$ post-review.py --list

In the common case, I already have a valid cookie, so post-review won't ask for my 
username. As a consequence, when post-review runs, it doesn't explicitly know the 
username at all. The whole point of this issue was that there is no mechanism to list 
the issues for the "current/logged in" user, nor is there a mechanism to fetch the 
username of the logged-in user.

I hope that clarifies. IIUC, the API still hasn't changed to support the behavior 
described in this issue.
chipx86
#5 chipx86
There likely won't be any resource path for "The logged in user's <anything>".
Instead, what I want to do is make it easier to find out the logged in user, and use
that for paths, so that we don't end up duplicating all the resources out there.
Otherwise, we'll get requests for the logged in user's:

* review requests
* reviews
* comments
* watched groups
* watched review requests
* profile information

etc

That's just a lot of extra stuff to maintain, and I don't want to go that route. I'll
repurpose this bug to make sure we add something for finding out the logged in user's
name and information. Perhaps even linking to prebuilt queries for things like the
review requests.
  • -Fixed
    +Confirmed
  • +API to obtain the logged in user's name.
#6 diwake******@gmai***** (Google Code) (Is this you? Claim this profile.)
I'd be perfectly happy with this approach. In fact, in my original request I said:

"I went through the JSON API but I'm at a loss to find a call that either gives me all 
the review requests for the logged in user, or some easy way to obtain the username of
the logged in user first and then use that to get the list of review requests."

So yes, a way to get at the user name would be perfect!
chipx86
#7 chipx86
Added a new /api/session/ resource, which points to the logged in user.

Committed to master (66b2f8c)
  • -Confirmed
    +Fixed