I am trying to add a watcher to an issue but I always run into 404. I believe this has worked before.
I am doing it in python but see below the curl command:
curl -i -u user:<APPKEY> -H "Content-Type: application/json -X POST -d '"myusername"' https://hostname/rest/api/3/issue/KEY/watchers
HTTP/1.1 404
Server: AtlassianProxy/1.15.8.1
Vary: Accept-Encoding
Cache-Control: no-cache, no-store, no-transform
Content-Type: application/json;charset=UTF-8
…
I have tried version 2 of the API as well. What is wrong with it? Is it a Jira bug?
Thank you
Renato
I solved by doing this:
curl -i -u user:<APPKEY> -H "Content-Type: application/json" -X POST -d '"accountId"' https://hostname/rest/api/3/issue/KEY/watchers
Using accountId did the trick here.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
404 means the issue doesn't exist or the user account doesn't have permissions. It should have returned an error message saying as such.
Does the issue exist? Does the user have permissions to watch the issue?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Additional facts:
* the issue exists;
* the user exists;
* the requesting user has permissions (MANAGE_WATCHERS);
* The body response is: {"errorMessages":[],"errors":{}}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
are you able to see the issue via https://hostname/rest/api/3/issue/KEY ?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks for the hint. That led me to this:
$ curl ... https://hostname/browse/KEY
200 ...
$ curl ... https://hostname/rest/api/2/issue/KEY
{"errorMessages":["Issue does not exist or you do not have permission to see it."],"errors":{}}
Seems like I can't access it with rest api but with /browse I get the result. This suggests that the error is not on the watchers endpoint (even though the error message was unclear).
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
are you using your email for the username?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Ok I figured this out by connecting the dots while working in some other Jira issue. Instead of using your username and email, you must set the accountId instead.
I guess that change must have been introduced recently due to GDPR concerns that also affected other Jira endpoints. I have not seen this change documented anywhere...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.