Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

can't add a watcher

RuijunFan May 25, 2016

I tried to add a watcher to one JIRA issue, but anyway,  it returns "bad request".

I can update assignee, comment, labels, .... with the similar code below, only watcher got me.

Thanks in advance.

my code is as below:

public void updateJiraWatcher(string key,string watcherName)

var request = new RestRequest()

{

Method=Method.Post,

Resource = "/rest/api/2/issue/"+key+"/watchers",

RequestFormat= DatFormat.JSon

};

string jsonWatcher ="{\""+watcherName+"\"}";  // "{\"username\":\""+watcherName +"\"}; ** doesn't work too

request.AddParameter("application/json",jsonWatcher,ParameterType.RequestBody);

var response = GetRequestsResponse(request); 

 

}

1 answer

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

0 votes
105349
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 25, 2016

Hello!  

I think that your syntax is slightly wrong for the watcherName.  Take a look at this Answer:

https://answers.atlassian.com/questions/61770

Good luck!

RuijunFan May 26, 2016

Thanks for reply.

To be honest, I have read Please Help! Got error 400 when trying to add watcher using REST API. lots of times, but no idea. sad.

Could you tell me exactly what is wrong with the syntax of WatcherName?

 

Thanks.

 

TAGS
AUG Leaders

Atlassian Community Events