On 30 Sep 2014 21:40, "Olivier Paule" <olivie...@gmail.com> wrote:
>
> Thanks for your response.
>
> I forgot something. This is for a php page. And I am under Windows (using wampserver). I cannot find where is the ~/.netrc for my Apache user.
>
This link should help [1]. Scroll down a bit and it explains the environment vars you need to set. Also note that the name of the file is _netrc on Windows, not .netrc as it is on Ubuntu et al.
> I tried with curl_setopt($curl, CURLOPT_USERPWD, "$username:$password"); but that does not work.
>
Please be more specific than "does not work". Does it fail to authenticate? Any error message?
It's a long time since I used php so I can't help with that. All I can suggest is to make sure the request is using digest authentication, or, try it without authentication by removing /a/ from the url.
> Le mardi 30 septembre 2014 12:21:43 UTC+2, David Pursehouse a écrit :
>>
>> On 09/30/2014 06:47 PM, Olivier Paule wrote:
>> > Hi all,
>> >
>> > I hope I'm in the good group to ask my question.
>> >
>> > Usually, I use the command "ssh www.myserver.com gerrit
>> > query --commit-message --current-patch-set 123456" to retrieve a JSON
>> > with data I need.
>> >
>> > I would like to retrieve the same data using the REST API of gerrit (on
>> > the url https://www.myserver.com/123456) but I'm stuck.
>> >
>> > Can someone help me please? :-)
>> >
>>
>> To get the same data as in your ssh command you will want to do
>> something like:
>>
>> curl -n --digest
>> "http://www.myserver.com/a/changes/CHANGEID/detail/?o=CURRENT_REVISION&o=CURRENT_COMMIT"
>>
>> - The HTTP username and password (from the "HTTP password" page on your
>> user settings) should be in the ~/.netrc file.
>>
>> - Replace "CHANGEID" with the Change Id in the format
>> "project~branch~revision". The project name and branch name should be
>> url encoded.
>>
>> For further details check the documentation [1].
>>
>> [1]
>> https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html
>
> --
> --
> To unsubscribe, email repo-discuss...@googlegroups.com
> More info at http://groups.google.com/group/repo-discuss?hl=en
>
> ---
> You received this message because you are subscribed to the Google Groups "Repo and Gerrit Discussion" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to repo-discuss...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
--
--
To unsubscribe, email repo-discuss+unsubscribe@googlegroups.com
More info at http://groups.google.com/group/repo-discuss?hl=en
--- You received this message because you are subscribed to a topic in the Google Groups "Repo and Gerrit Discussion" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/repo-discuss/PPQz0b3WPnE/unsubscribe.
To unsubscribe from this group and all its topics, send an email to repo-discuss+unsubscribe@googlegroups.com.
tring '<html> <head> <meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-1"/> <title>Error 401 Unauthorized</title> </head> <body> <h2>HTTP ERROR: 401</h2> <p>Problem accessing /a/changes/I6297404807fbd1e99a30c28fxxxfda3a5404391/detail/. Reason: <pre> Unauthorized</pre></p> <hr /><i><small>Powered by Jetty://</small></i>