Not sure if this is a double posting or re-asking for help. Did you see my
response about the "/" in the URL and the conditions on which the review
request will be shown in the results?

Christian

-- 
Christian Hammond - chip...@chipx86.com
Review Board - http://www.reviewboard.org
VMware, Inc. - http://www.vmware.com


On Tue, Sep 27, 2011 at 10:11 PM, jack jack <jais...@gmail.com> wrote:

> Hi Chris,
>>
>> If i comment out that part of the code i.e ( def
>> get_review_request_by_changenum) the posting of review request is progressed
>> ahead. But as i told i am trying to get the review id from the changenum, I
>> am not able to do so as you told that API has changed.
>>
>>
>> Also HTTP Basic Auth is being taken care. What my question is
>>
>> 1.  The URL generated by me ( self.myurl = self.rbserver +
>> '/api/review-requests/?changenum=%s&repository=1/' % changenum) is correct
>> or not.
>> 2.  What extra step i need to do so that i can fetch review id,
>> 3.  My code to get the review id from the changenum is correct or not, if
>> not what i am missing here.
>>
>>
>>
>>    def get_review_request_by_changenum(self, changenum):
>>         """
>>             Get the review request object via a perforce changelist
>>
>>             Args: 'changenum' - perforce changelist
>>             json call: http://
>> <reviewboard>/api/json/reviewrequests/repository/1/<changenum>/
>>         """
>>         if changenum == 'default':
>>             print "default not allowed. please a pending or submitted
>> changelist"
>>             sys.exit(1)
>>         self.myurl = self.rbserver +
>> '/api/review-requests/?changenum=%s&repository=1/' % changenum
>>  *        self.urlopen = self.opener.open(self.myurl,self.data)*    *<<<<<<<
>> do i need to follow any other approach.*
>>
>>         self.result = simplejson.load(self.urlopen)
>>         if self.result['stat'] == "ok":
>>             self.dict = self.result['review_request']
>>             return self.dict
>>         else:
>>             return
>>
>> Thanks in advance.
>>
>> Jack.
>>
>>
>> On Tue, Sep 27, 2011 at 2:50 PM, Christian Hammond 
>> <chip...@chipx86.com>wrote:
>>
>>> You don't want the / in the arguments to the URL.
>>>
>>> The HTTP Authorization Required means you need to supply the credentials
>>> for a user in the request. This uses the standard HTTP Basic Auth spec, of
>>> which there are many examples of uses in Python.
>>>
>>> See
>>> http://www.reviewboard.org/docs/manual/dev/webapi/2.0/authenticating/
>>>
>>> You can pre-login for such requests by just setting that Authorization
>>> header for any request.
>>>
>>>
>>> Christian
>>>
>>> --
>>> Christian Hammond - chip...@chipx86.com
>>> Review Board - http://www.reviewboard.org
>>> VMware, Inc. - http://www.vmware.com
>>>
>>>
>>> On Tue, Sep 27, 2011 at 2:15 AM, jack jack <jais...@gmail.com> wrote:
>>>
>>>> I generated the URL as
>>>>
>>>>
>>>> http://ccsdtool.na.xxxxxware.com/ccsdtool/api/review-requests/?changenum=119631&repository=1/
>>>>
>>>> self.myurl = self.rbserver +
>>>> '/api/review-requests/?changenum=%s&repository=1/' % changenum
>>>>
>>>> And pass this url, if you look into the code snippet below once i get
>>>> the self.myurl, this is passed to self.opener.open(self.myurl,self.data),
>>>> hence while doing so i am getting error message as
>>>>
>>>> urllib2.HTTPError: HTTP Error 401: Authorization Required
>>>>
>>>> here is the complete code snippet.
>>>>
>>>>
>>>>     def get_review_request_by_changenum(self, changenum):
>>>>         """
>>>>             Get the review request object via a perforce changelist
>>>>
>>>>             Args: 'changenum' - perforce changelist
>>>>             json call: http://
>>>> <reviewboard>/api/json/reviewrequests/repository/1/<changenum>/
>>>>         """
>>>>         if changenum == 'default':
>>>>             print "default not allowed. please a pending or submitted
>>>> changelist"
>>>>             sys.exit(1)
>>>>         self.myurl = self.rbserver +
>>>> '/api/review-requests/?changenum=%s&repository=1/' % changenum
>>>> *        self.urlopen = self.opener.open(self.myurl,self.data)*    *<<<<<<<
>>>> do i need to follow any other approach.*
>>>>
>>>>         self.result = simplejson.load(self.urlopen)
>>>>         if self.result['stat'] == "ok":
>>>>             self.dict = self.result['review_request']
>>>>             return self.dict
>>>>         else:
>>>>             return
>>>>
>>>>
>>>>
>>>>  On Tue, Sep 27, 2011 at 2:18 PM, Christian Hammond <
>>>> chip...@chipx86.com> wrote:
>>>>
>>>>>  In this case, it doesn't look as if you have any review requests with
>>>>> that changenum on that repository that are accessible via your user.
>>>>>
>>>>> This will by default only show ones that are opened for review and
>>>>> publicly viewable. If you want ones that are also closed, you can also 
>>>>> pass
>>>>> &status=all.
>>>>>
>>>>> If you want ones that are still not public but owned by your user, you
>>>>> must make sure to make the request along with HTTP Basic Auth credentials
>>>>> passed. See the docs on how to do that.
>>>>>
>>>>>
>>>>> Christian
>>>>>
>>>>> --
>>>>> Christian Hammond - chip...@chipx86.com
>>>>> Review Board - http://www.reviewboard.org
>>>>> VMware, Inc. - http://www.vmware.com
>>>>>
>>>>>
>>>>> On Tue, Sep 27, 2011 at 1:43 AM, jack jack <jais...@gmail.com> wrote:
>>>>>
>>>>>> This the output in the browser when pasted the link.
>>>>>>
>>>>>>
>>>>>> http://ccsdtool.na.xxxxxxware.com/ccsdtool/api/review-requests/?changenum=119631&repository=1
>>>>>>
>>>>>>
>>>>>> <rsp><total_results>0</total_results><stat>ok</stat><review_requests><array>
>>>>>>   </array></review_requests><links><self><href>
>>>>>> http://ccsdtool.na.xxxxxxware.com/ccsdtool/api/review-requests/?changenum=119631&repository=1
>>>>>> </href><method>GET</method></self><create><href>
>>>>>> http://ccsdtool.na.xxxxxxware.com/ccsdtool/api/review-requests/
>>>>>> </href><method>POST</method></create></links></rsp>
>>>>>>
>>>>>> Also attaching screen shot.
>>>>>>
>>>>>> Do let me know if you need any information.
>>>>>>
>>>>>>
>>>>>> On Tue, Sep 27, 2011 at 2:06 PM, Christian Hammond <
>>>>>> chip...@chipx86.com> wrote:
>>>>>>
>>>>>>> It would help to know what you are seeing. If that review request is
>>>>>>> public, on the provided repository, with the provided changenum, you 
>>>>>>> should
>>>>>>> see it.
>>>>>>>
>>>>>>>
>>>>>>> Christian
>>>>>>>
>>>>>>> --
>>>>>>> Christian Hammond - chip...@chipx86.com
>>>>>>> Review Board - http://www.reviewboard.org
>>>>>>> VMware, Inc. - http://www.vmware.com
>>>>>>>
>>>>>>>
>>>>>>> On Tue, Sep 27, 2011 at 1:30 AM, jack jack <jais...@gmail.com>wrote:
>>>>>>>
>>>>>>>> Thanks Chris
>>>>>>>>
>>>>>>>> I followed the link as per your suggestion but i could not see field
>>>>>>>> review request id in XML output. What i am expecting the
>>>>>>>> get_review_request_by_
>>>>>>>> changenum subroutine should return review id or i am missing
>>>>>>>> something here.
>>>>>>>>
>>>>>>>> Regards,
>>>>>>>> Jack.
>>>>>>>>
>>>>>>>>
>>>>>>>> On Tue, Sep 27, 2011 at 1:33 PM, Christian Hammond <
>>>>>>>> chip...@chipx86.com> wrote:
>>>>>>>>
>>>>>>>>> You want this format now:
>>>>>>>>>
>>>>>>>>> http://
>>>>>>>>> <rbserver>/api/review-requests/?changenum=<changenum>&repository=<repository_id>
>>>>>>>>>
>>>>>>>>> That will return a list matching that criteria. The first item will
>>>>>>>>> be what you want. You can use that data as-is or follow the links in 
>>>>>>>>> the
>>>>>>>>> payload.
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> Christian
>>>>>>>>>
>>>>>>>>> --
>>>>>>>>> Christian Hammond - chip...@chipx86.com
>>>>>>>>> Review Board - http://www.reviewboard.org
>>>>>>>>> VMware, Inc. - http://www.vmware.com
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> On Mon, Sep 26, 2011 at 11:23 PM, jack jack <jais...@gmail.com>wrote:
>>>>>>>>>
>>>>>>>>>> Hi,
>>>>>>>>>>
>>>>>>>>>> As per your suggestion i browse the tree at /api and also at
>>>>>>>>>> /api/review-requests/ but don't see review id also the changenum. 
>>>>>>>>>> Could you
>>>>>>>>>> please provide me complete HTTP URL where should i get the review ID 
>>>>>>>>>> for
>>>>>>>>>> changenum.
>>>>>>>>>>
>>>>>>>>>> I may be missing lot of thing here ....but after upgrading the RB
>>>>>>>>>> 1.0 to 1.6.1 my wrapper which was expecting some of the api failing 
>>>>>>>>>> and i
>>>>>>>>>> need to write complete wrapper again.
>>>>>>>>>>
>>>>>>>>>> Please help me or provide me pointer.
>>>>>>>>>>
>>>>>>>>>> Here is my existing subroutine which
>>>>>>>>>>
>>>>>>>>>>     def get_review_request_by_changenum(self, changenum):
>>>>>>>>>>         """
>>>>>>>>>>             Get the review request object via a perforce
>>>>>>>>>> changelist
>>>>>>>>>>
>>>>>>>>>>             Args: 'changenum' - perforce changelist
>>>>>>>>>>             json call: http://
>>>>>>>>>> <reviewboard>/api/json/reviewrequests/repository/1/<changenum>/
>>>>>>>>>>         """
>>>>>>>>>>         if changenum == 'default':
>>>>>>>>>>             print "default not allowed. please a pending or
>>>>>>>>>> submitted changelist"
>>>>>>>>>>             sys.exit(1)
>>>>>>>>>>         self.myurl = self.rbserver \
>>>>>>>>>>                        +
>>>>>>>>>> '/api/json/reviewrequests/repository/1/changenum/' \
>>>>>>>>>>                        + changenum + '/'
>>>>>>>>>>        self.urlopen = self.opener.open(self.myurl,self.data)
>>>>>>>>>>
>>>>>>>>>>         self.result = simplejson.load(self.urlopen)
>>>>>>>>>>
>>>>>>>>>>         if self.result['stat'] == "ok":
>>>>>>>>>>             self.dict = self.result['review_request']
>>>>>>>>>>             return self.dict
>>>>>>>>>>         else:
>>>>>>>>>>             return
>>>>>>>>>>
>>>>>>>>>> Please correct me for the above code....I got blocked.
>>>>>>>>>>
>>>>>>>>>> Regards,
>>>>>>>>>> Jack
>>>>>>>>>>
>>>>>>>>>> On Tue, Sep 27, 2011 at 12:05 AM, Christian Hammond <
>>>>>>>>>> chip...@chipx86.com> wrote:
>>>>>>>>>>
>>>>>>>>>>> I don't have any sample code to show you. It's just an HTTP GET
>>>>>>>>>>> at the URL, though. You can browse the tree at /api/.
>>>>>>>>>>>
>>>>>>>>>>> post-review may be useful for some bits of that.
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> Christian
>>>>>>>>>>>
>>>>>>>>>>> --
>>>>>>>>>>> Christian Hammond - chip...@chipx86.com
>>>>>>>>>>> Review Board - http://www.reviewboard.org
>>>>>>>>>>> VMware, Inc. - http://www.vmware.com
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> On Mon, Sep 26, 2011 at 11:30 AM, jack jack 
>>>>>>>>>>> <jais...@gmail.com>wrote:
>>>>>>>>>>>
>>>>>>>>>>>> Thanks Christian,
>>>>>>>>>>>>
>>>>>>>>>>>> Could you please point me with sample code for the usage of
>>>>>>>>>>>> these new webapi.
>>>>>>>>>>>>
>>>>>>>>>>>> On Mon, Sep 26, 2011 at 9:53 PM, Christian Hammond <
>>>>>>>>>>>> chip...@chipx86.com> wrote:
>>>>>>>>>>>>
>>>>>>>>>>>>> Hi Jack,
>>>>>>>>>>>>>
>>>>>>>>>>>>> No, that old API was removed. This will work, though:
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>> http://www.reviewboard.org/docs/manual/1.5/webapi/2.0/resources/review-request-list/
>>>>>>>>>>>>>
>>>>>>>>>>>>> Basically, you can pass ?changenum= to get a list with that
>>>>>>>>>>>>> changenum (and you can also narrow down by repository and other 
>>>>>>>>>>>>> criteria).
>>>>>>>>>>>>>
>>>>>>>>>>>>> Christian
>>>>>>>>>>>>>
>>>>>>>>>>>>> --
>>>>>>>>>>>>> Christian Hammond - chip...@chipx86.com
>>>>>>>>>>>>> Review Board - http://www.reviewboard.org
>>>>>>>>>>>>> VMware, Inc. - http://www.vmware.com
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>> On Mon, Sep 26, 2011 at 4:16 AM, jack jack 
>>>>>>>>>>>>> <jais...@gmail.com>wrote:
>>>>>>>>>>>>>
>>>>>>>>>>>>>> I am writing a wrapper to get the review-request by changenum.
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> I wanted to know, does this json api call is still valid for
>>>>>>>>>>>>>> RB server
>>>>>>>>>>>>>> 1.6.
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> http://www.reviewboard.org/docs/manual/1.5/webapi/1.0/reference/apicalls/get-review-request-by-changenum/
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> if not then please point me to the version where i can get the
>>>>>>>>>>>>>> similar
>>>>>>>>>>>>>> operation.
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> Thanks in advance.
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> --
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> Want to help the Review Board project? Donate today at
>>>>>>>>>>>>>> http://www.reviewboard.org/donate/
>>>>>>>>>>>>>> Happy user? Let us know at http://www.reviewboard.org/users/
>>>>>>>>>>>>>> -~----------~----~----~----~------~----~------~--~---
>>>>>>>>>>>>>> To unsubscribe from this group, send email to
>>>>>>>>>>>>>> reviewboard+unsubscr...@googlegroups.com
>>>>>>>>>>>>>> For more options, visit this group at
>>>>>>>>>>>>>> http://groups.google.com/group/reviewboard?hl=en
>>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>  --
>>>>>>>>>>>>> Want to help the Review Board project? Donate today at
>>>>>>>>>>>>> http://www.reviewboard.org/donate/
>>>>>>>>>>>>> Happy user? Let us know at http://www.reviewboard.org/users/
>>>>>>>>>>>>> -~----------~----~----~----~------~----~------~--~---
>>>>>>>>>>>>> To unsubscribe from this group, send email to
>>>>>>>>>>>>> reviewboard+unsubscr...@googlegroups.com
>>>>>>>>>>>>> For more options, visit this group at
>>>>>>>>>>>>> http://groups.google.com/group/reviewboard?hl=en
>>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>  --
>>>>>>>>>>>> Want to help the Review Board project? Donate today at
>>>>>>>>>>>> http://www.reviewboard.org/donate/
>>>>>>>>>>>> Happy user? Let us know at http://www.reviewboard.org/users/
>>>>>>>>>>>> -~----------~----~----~----~------~----~------~--~---
>>>>>>>>>>>> To unsubscribe from this group, send email to
>>>>>>>>>>>> reviewboard+unsubscr...@googlegroups.com
>>>>>>>>>>>> For more options, visit this group at
>>>>>>>>>>>> http://groups.google.com/group/reviewboard?hl=en
>>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>  --
>>>>>>>>>>> Want to help the Review Board project? Donate today at
>>>>>>>>>>> http://www.reviewboard.org/donate/
>>>>>>>>>>> Happy user? Let us know at http://www.reviewboard.org/users/
>>>>>>>>>>> -~----------~----~----~----~------~----~------~--~---
>>>>>>>>>>> To unsubscribe from this group, send email to
>>>>>>>>>>> reviewboard+unsubscr...@googlegroups.com
>>>>>>>>>>> For more options, visit this group at
>>>>>>>>>>> http://groups.google.com/group/reviewboard?hl=en
>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>  --
>>>>>>>>>> Want to help the Review Board project? Donate today at
>>>>>>>>>> http://www.reviewboard.org/donate/
>>>>>>>>>> Happy user? Let us know at http://www.reviewboard.org/users/
>>>>>>>>>> -~----------~----~----~----~------~----~------~--~---
>>>>>>>>>> To unsubscribe from this group, send email to
>>>>>>>>>> reviewboard+unsubscr...@googlegroups.com
>>>>>>>>>> For more options, visit this group at
>>>>>>>>>> http://groups.google.com/group/reviewboard?hl=en
>>>>>>>>>>
>>>>>>>>>
>>>>>>>>>  --
>>>>>>>>> Want to help the Review Board project? Donate today at
>>>>>>>>> http://www.reviewboard.org/donate/
>>>>>>>>> Happy user? Let us know at http://www.reviewboard.org/users/
>>>>>>>>> -~----------~----~----~----~------~----~------~--~---
>>>>>>>>> To unsubscribe from this group, send email to
>>>>>>>>> reviewboard+unsubscr...@googlegroups.com
>>>>>>>>> For more options, visit this group at
>>>>>>>>> http://groups.google.com/group/reviewboard?hl=en
>>>>>>>>>
>>>>>>>>
>>>>>>>>  --
>>>>>>>> Want to help the Review Board project? Donate today at
>>>>>>>> http://www.reviewboard.org/donate/
>>>>>>>> Happy user? Let us know at http://www.reviewboard.org/users/
>>>>>>>> -~----------~----~----~----~------~----~------~--~---
>>>>>>>> To unsubscribe from this group, send email to
>>>>>>>> reviewboard+unsubscr...@googlegroups.com
>>>>>>>> For more options, visit this group at
>>>>>>>> http://groups.google.com/group/reviewboard?hl=en
>>>>>>>>
>>>>>>>
>>>>>>>  --
>>>>>>> Want to help the Review Board project? Donate today at
>>>>>>> http://www.reviewboard.org/donate/
>>>>>>> Happy user? Let us know at http://www.reviewboard.org/users/
>>>>>>> -~----------~----~----~----~------~----~------~--~---
>>>>>>> To unsubscribe from this group, send email to
>>>>>>> reviewboard+unsubscr...@googlegroups.com
>>>>>>> For more options, visit this group at
>>>>>>> http://groups.google.com/group/reviewboard?hl=en
>>>>>>>
>>>>>>
>>>>>>  --
>>>>>> Want to help the Review Board project? Donate today at
>>>>>> http://www.reviewboard.org/donate/
>>>>>> Happy user? Let us know at http://www.reviewboard.org/users/
>>>>>> -~----------~----~----~----~------~----~------~--~---
>>>>>> To unsubscribe from this group, send email to
>>>>>> reviewboard+unsubscr...@googlegroups.com
>>>>>> For more options, visit this group at
>>>>>> http://groups.google.com/group/reviewboard?hl=en
>>>>>>
>>>>>
>>>>>  --
>>>>> Want to help the Review Board project? Donate today at
>>>>> http://www.reviewboard.org/donate/
>>>>> Happy user? Let us know at http://www.reviewboard.org/users/
>>>>> -~----------~----~----~----~------~----~------~--~---
>>>>> To unsubscribe from this group, send email to
>>>>> reviewboard+unsubscr...@googlegroups.com
>>>>> For more options, visit this group at
>>>>> http://groups.google.com/group/reviewboard?hl=en
>>>>>
>>>>
>>>>  --
>>>> Want to help the Review Board project? Donate today at
>>>> http://www.reviewboard.org/donate/
>>>> Happy user? Let us know at http://www.reviewboard.org/users/
>>>> -~----------~----~----~----~------~----~------~--~---
>>>> To unsubscribe from this group, send email to
>>>> reviewboard+unsubscr...@googlegroups.com
>>>> For more options, visit this group at
>>>> http://groups.google.com/group/reviewboard?hl=en
>>>>
>>>
>>>  --
>>> Want to help the Review Board project? Donate today at
>>> http://www.reviewboard.org/donate/
>>> Happy user? Let us know at http://www.reviewboard.org/users/
>>> -~----------~----~----~----~------~----~------~--~---
>>> To unsubscribe from this group, send email to
>>> reviewboard+unsubscr...@googlegroups.com
>>> For more options, visit this group at
>>> http://groups.google.com/group/reviewboard?hl=en
>>>
>>
>>
>  --
> Want to help the Review Board project? Donate today at
> http://www.reviewboard.org/donate/
> Happy user? Let us know at http://www.reviewboard.org/users/
> -~----------~----~----~----~------~----~------~--~---
> To unsubscribe from this group, send email to
> reviewboard+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/reviewboard?hl=en
>

-- 
Want to help the Review Board project? Donate today at 
http://www.reviewboard.org/donate/
Happy user? Let us know at http://www.reviewboard.org/users/
-~----------~----~----~----~------~----~------~--~---
To unsubscribe from this group, send email to 
reviewboard+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/reviewboard?hl=en

Reply via email to