Has anyone successfully used the REST interface to update watched.projects?

42 views
Skip to first unread message

Matthew Webber

unread,
Sep 20, 2017, 10:01:03 AM9/20/17
to Repo and Gerrit Discussion
I'm trying to use the REST interface to update my watched projects, and it keeps throwing an error. Have I missed something, or is this a reportable bug? Gerrit release is 2.14.3

Querying the existing watched projects works ok:
$ curl --basic -K passwords/http-password_Gerrit_for-curl.txt -X GET https://gerrit.DOMAIN/a/accounts/self/watched.projects
)]}'
[
  {
    "project": "gda/gda-legacy",
    "notify_submitted_changes": true
  }
]

But an attempt to update the list gives a 404:
$ cat  ~/gerrit-command.txt 
{
  "project": "gda/gda-core",
  "notify_submitted_changes": true
}
$ curl --basic -K passwords/http-password_Gerrit_for-curl.txt -X PUT -H "Content-Type: application/json" -d @gerrit-command.txt https://gerrit.DOMAIN/a/accounts/self/watched.projects
Not found: watched.projects

Gerrit is running behind an Nginx reverse proxy. The Gerrit httpd_log shows that the request is making it through to Gerrit ok. There's nothing in error_log.
I've used curl in a similar way to PUT to other resources, and it's always worked.

A quick look at the Gerrit source code shows that there's definitely code there to handle watched.projects. Maybe it's buggy, or have I done something wrong?

Thanks
Matthew

Edwin Kempin

unread,
Sep 20, 2017, 10:23:51 AM9/20/17
to Matthew Webber, Repo and Gerrit Discussion
It must be a POST request (not PUT).
 

Thanks
Matthew

--
--
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 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+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Matthew Webber

unread,
Sep 21, 2017, 5:58:37 AM9/21/17
to Repo and Gerrit Discussion
On Wednesday, 20 September 2017 15:23:51 UTC+1, Edwin Kempin wrote:
It must be a POST request (not PUT).
Thanks, POST worked.
(I needed to slight adjust the json to pass a list).
Matthew
Reply all
Reply to author
Forward
0 new messages