Go back and thoroughly read and understand the API documentation. Read the post-review source code. You're taking wild stabs in the dark with incorrect fields and URLs. That URL you're posting to is not an API URL.
Also, keep all this to *one* thread. There's posts from you about this all over the place now, and that's not okay. Christian -- Christian Hammond - chip...@chipx86.com Review Board - http://www.reviewboard.org VMware, Inc. - http://www.vmware.com On Feb 26, 2013, at 2:23 AM, cmuser <kapilanar...@gmail.com> wrote: > Sorry for disturbing you all asking such stupid question. But i am badly > stuck. :( > This is what i tried now, still no gain > > curl -k -H "Authorization: Basic YWRtaW46YWRtaW4=" -X POST -d > "repository_id=cvsrepo&username=kapila&password=kapila123&submit-as=kapila" > http://codereview.xyz.com/r/new/ > > wondering why this command worked yesterday once > > curl -k -H "Authorization: Basic YWRtaW46YWRtaW4=" -X POST -d > "{\"repository_id\": > "cvsrepo",\"repository_path\":":pserver:kapilap:kapila123@svn:/opt/cvsroot",\"username\":"kapila",\"password\":"kapila123",\"submit-as\":"kapila"}" > "http://codereview.xyz.com/r/new/" > > @gavin, I am trying to integrate Bugzilla with Reviewboard so as a review > request gets created whenever a new bug filled. > > On Tuesday, February 26, 2013 2:34:05 PM UTC+5:30, Christian Hammond wrote: > The curl command is pretty wrong. > > You're still not passing an Authorization header. -H by itself doesn't turn > the value into one. You're also submitting JSON data, not form data. The > server won't be able to recognize any of that. > > Christian > > -- > Christian Hammond - chi...@chipx86.com > Review Board - http://www.reviewboard.org > VMware, Inc. - http://www.vmware.com > > On Feb 26, 2013, at 12:45 AM, cmuser <kapila...@gmail.com> wrote: > >> Thanks. I will try & follow it. >> What i did is , tried writing the script(mentioned above) to post a review >> request which is failing of xyz reason. So thought of using HTTP::Recorder >> to get the script of posting a review request. But again facing issues in >> that. >> >> curl command which worked once - >> curl -k -H "Basic YWRtaW46YWRtaW4=" -X POST -d "{\"repository_id\": >> "cvsrepo",\"repository_path\":":pserver:kapila:kapila123@svn:/opt/cvsroot",\"username\":"kapila",\"password\":"kapila123",\"submit-as\":"kapila"}" >> "http://codereview.xyz.com/r/new >> >> Would be great if you can share your script to give quick & better >> understanding. >> >> On Tuesday, February 26, 2013 2:08:54 PM UTC+5:30, Gavin Main wrote: >> After a bit of fiddling and research I found that the LWP and HTTP::Cookies >> modules worked for me. Have a look at the documentation on CPAN >> >> http://search.cpan.org/~gaas/HTTP-Cookies-6.01/lib/HTTP/Cookies.pm >> >> This link was also very helful: >> http://lwp.interglacial.com/ch11_01.htm >> >> >> Basically I wanted my post-commit hook to close out an associated review on >> Reviewboard. So I wrote two subroutines to do that. The first generated the >> cookie: >> - create the cookie file >> - issue the get request with HTTP::Request >> - authenticate with authorization_basic >> - extract the cookie >> - return hash >> >> Then I passed the cookie hash to another subroutine which issued my PUT >> request with the information inside the cookie hash. >> >> Cheers, >> Gavin >> >> >> On Monday, 25 February 2013 21:25:13 UTC+8, cmuser wrote: >> i have tried to built like this,but still not working >> >> #!/usr/local/bin/perl >> >> use LWP::UserAgent; >> use MIME::Base64; >> >> $url="http://codereview.xyz.com/api/review-requests/"; >> $newurl="http://codereview.xyz.com/r/new/"; >> $user="admin"; >> $pwd="admin"; >> >> $text="$user:$pwd"; >> $text = encode_base64($text); >> #print "Encoded text: $text\n"; >> %param =( >> "repository_id" =>"cvsrepo", >> "repository_path" =>":pserver:user:pwd\@svn:/opt/cvsroot", >> "username" => "admin", >> "password" => "admin", >> "submit-as" => "username", >> ); >> my $ua = LWP::UserAgent->new; >> $ua->timeout(TIMEOUT); >> $ua->protocols_allowed(['http', 'https']); >> $ua->default_header('Basic' => $text); >> $ua->credentials($newurl,$user,$pwd); >> >> $resp = $ua->get($url); >> print($resp->status_line(), "\n"); >> >> print("Add handler:\n"); >> $ua->add_handler( response_header => sub { print "HANDLER\n"; }, >> %param); >> print $ua->handlers('response_header', $resp)."\n"; >> push @{ $ua->requests_redirectable }, 'POST'; >> print $ua->show_progress."\n"; >> my $response = $ua->post($newurl,%param); >> >> if ($response->is_success) { >> print $response->decoded_content; >> } >> else { >> die $response->status_line; >> } >> >> >> >> On Friday, August 10, 2012 2:56:12 PM UTC+5:30, Gavin Main wrote: >> Hi Jeff, did you ever get this resolved? I am facing a similar issue. >> >> Christian, I am loving Reviewboard. Thank You!!! >> >> Cheers, >> Gav >> >> On Friday, 22 October 2010 02:06:16 UTC+8, Jeff wrote: >> I'm trying to write an svn pre-commit hook against a totally new >> installation of reviewboard 1.5 (upgraded from the previous version, >> but never really used). >> >> As far as I can tell from the documentation, the json login page isn't >> used anymore, and I just use basic HTTP authentication. >> >> My perl code looks like this: >> >> #!/usr/bin/perl >> use LWP::UserAgent; >> >> my $ua = LWP::UserAgent->new; >> #$ua->credentials("$rbhost:80","Web API",'user' => 'password'); >> >> my $req = HTTP::Request->new(GET => "http://reviewboard.local.com/ >> rboard/api/review-requests/93/last-update/"); >> $req->authorization_basic('user', 'password'); >> >> my $res = $ua->request($req); >> print $res->as_string; >> >> >> I've tried both the useragent credential and the request- >> >authorization_basic. >> >> The result I get back is: >> >> >> HTTP/1.1 401 UNAUTHORIZED >> Cache-Control: max-age=0 >> Connection: close >> Date: Thu, 21 Oct 2010 17:53:43 GMT >> ETag: "3818aa0b0928af747aebc006814783fe" >> Server: Apache/2.2.3 (CentOS) >> Vary: Cookie,Accept-Language >> WWW-Authenticate: Basic realm="Web API" >> Content-Language: en-us >> Content-Length: 70 >> Content-Type: application/json >> Expires: Thu, 21 Oct 2010 17:53:43 GMT >> Last-Modified: Thu, 21 Oct 2010 17:53:43 GMT >> Client-Date: Thu, 21 Oct 2010 17:53:43 GMT >> Client-Peer: 10.20.30.183:80 >> Client-Response-Num: 1 >> >> {"stat": "fail", "err": {"msg": "You are not logged in", "code": 103}} >> >> >> >> If I try and hit the same page in an web browser after authenticating, >> I get a 500 error and an email post at the end of this message. >> >> What am I doing wrong? Is there any example perl code that hit's the >> new API? I assume the existing stuff that I'm finding on the net >> won't work anymore. >> >> >> Traceback (most recent call last): >> >> File "/usr/local/reviewboard/python/Django-1.2.1-py2.7.egg/django/ >> core/handlers/base.py", line 100, in get_response >> response = callback(request, *callback_args, **callback_kwargs) >> >> File "/usr/local/reviewboard/python/Django-1.2.1-py2.7.egg/django/ >> views/decorators/cache.py", line 70, in _wrapped_view_func >> add_never_cache_headers(response) >> >> File "/usr/local/reviewboard/python/Django-1.2.1-py2.7.egg/django/ >> utils/cache.py", line 116, in add_never_cache_headers >> patch_response_headers(response, cache_timeout=-1) >> >> File "/usr/local/reviewboard/python/Django-1.2.1-py2.7.egg/django/ >> utils/cache.py", line 105, in patch_response_headers >> response['ETag'] = '"%s"' % >> md5_constructor(response.content).hexdigest() >> >> File "/usr/local/reviewboard/python/Djblets-0.6.4-py2.7.egg/djblets/ >> webapi/core.py", line 273, in _get_content >> content = adapter.encode(self.api_data, request=self.request) >> >> File "/usr/local/reviewboard/python/Djblets-0.6.4-py2.7.egg/djblets/ >> webapi/core.py", line 119, in encode >> self.__encode(o, *args, **kwargs) >> >> File "/usr/local/reviewboard/python/Djblets-0.6.4-py2.7.egg/djblets/ >> webapi/core.py", line 136, in __encode >> self.__encode(value, *args, **kwargs) >> >> File "/usr/local/reviewboard/python/Djblets-0.6.4-py2.7.egg/djblets/ >> webapi/core.py", line 136, in __encode >> self.__encode(value, *args, **kwargs) >> >> File "/usr/local/reviewboard/python/Djblets-0.6.4-py2.7.egg/djblets/ >> webapi/core.py", line 164, in __encode >> return self.__encode(result, *args, **kwargs) >> >> File "/usr/local/reviewboard/python/Djblets-0.6.4-py2.7.egg/djblets/ >> webapi/core.py", line 136, in __encode >> self.__encode(value, *args, **kwargs) >> >> File "/usr/local/reviewboard/python/Djblets-0.6.4-py2.7.egg/djblets/ >> webapi/core.py", line 162, in __encode >> raise TypeError("%r is not XML serializable" % (o,)) >> >> TypeError: 2L is not XML serializable >> >> >> <WSGIRequest >> GET:<QueryDict: {}>, >> POST:<QueryDict: {}>, >> COOKIES:{'csrftoken': '3c25a25c4c6ced636686afac7a25a4f1', >> 'rbsessionid': '2aeedaf117ffddcef6c72c0d5a2a407b'}, >> META:{'DOCUMENT_ROOT': '/usr/local/reviewboard/web/htdocs', >> 'GATEWAY_INTERFACE': 'CGI/1.1', >> 'HTTP_ACCEPT': 'text/html,application/xhtml+xml,application/ >> xml;q=0.9,*/*;q=0.8', >> 'HTTP_ACCEPT_CHARSET': 'ISO-8859-1,utf-8;q=0.7,*;q=0.7', >> 'HTTP_ACCEPT_ENCODING': 'gzip,deflate', >> 'HTTP_ACCEPT_LANGUAGE': 'en-us,en;q=0.5', >> 'HTTP_CONNECTION': 'keep-alive', >> 'HTTP_COOKIE': 'rbsessionid=2aeedaf117ffddcef6c72c0d5a2a407b; >> csrftoken=3c25a25c4c6ced636686afac7a25a4f1', >> 'HTTP_HOST': 'reviewboard', >> 'HTTP_KEEP_ALIVE': '115', >> 'HTTP_USER_AGENT': 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; >> rv:1.9.2.10) Gecko/20100914 Firefox/3.6.10', >> 'PATH': '/sbin:/usr/sbin:/bin:/usr/bin', >> 'PATH_INFO': u'/rboard/api/review-requests/93/last-update/', >> 'PATH_TRANSLATED': '/usr/local/reviewboard/web/htdocs/ >> reviewboard.fcgi/rboard/api/review-requests/93/last-update/', >> 'QUERY_STRING': '', >> 'REMOTE_ADDR': '10.20.68.52', >> 'REMOTE_PORT': '3620', >> 'REQUEST_METHOD': 'GET', >> 'REQUEST_URI': '/rboard/api/review-requests/93/last-update/', >> 'SCRIPT_FILENAME': '/usr/local/reviewboard/web/htdocs/ >> reviewboard.fcgi', >> 'SCRIPT_NAME': u'', >> 'SCRIPT_URI': 'http://reviewboard/rboard/api/review-requests/93/last- >> update/', >> 'SCRIPT_URL': '/rboard/api/review-requests/93/last-update/', >> 'SERVER_ADDR': '10.20.30.183', >> 'SERVER_ADMIN': 'root@localhost', >> 'SERVER_NAME': 'reviewboard', >> 'SERVER_PORT': '80', >> 'SERVER_PROTOCOL': 'HTTP/1.1', >> 'SERVER_SIGNATURE': '<address>Apache/2.2.3 (CentOS) Server at >> reviewboard Port 80</address>\n', >> 'SERVER_SOFTWARE': 'Apache/2.2.3 (CentOS)', >> 'wsgi.errors': <flup.server.fcgi_base.OutputStream object at >> 0x197b4c50>, >> 'wsgi.input': <flup.server.fcgi_base.InputStream object at >> 0x197b4910>, >> 'wsgi.multiprocess': False, >> 'wsgi.multithread': True, >> 'wsgi.run_once': False, >> 'wsgi.url_scheme': 'http', >> 'wsgi.version': (1, 0)}> >> >> >> -- >> 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...@googlegroups.com >> For more options, visit this group at >> http://groups.google.com/group/reviewboard?hl=en >> --- >> You received this message because you are subscribed to the Google Groups >> "reviewboard" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to reviewboard...@googlegroups.com. >> For more options, visit https://groups.google.com/groups/opt_out. >> >> > > > -- > 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 > --- > You received this message because you are subscribed to the Google Groups > "reviewboard" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to reviewboard+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/groups/opt_out. > > -- 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 --- You received this message because you are subscribed to the Google Groups "reviewboard" group. To unsubscribe from this group and stop receiving emails from it, send an email to reviewboard+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.