Add watchers to existing issue ticket using R

Akshat Sanghvi
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
February 20, 2024

Hi everyone, 

I am using following method to add multiple watchers to an existing ticket using R, but I am getting 400 status code.

issue_key <- 'issue-ticket'

watchers_url <- paste('my-company-jira-url', issue_key, '/watchers', sep='')


watchers_to_add <- c("ABC", "XYZ") #denotes username of watchers

watchers_data <- list( watchers = lapply(watchers_to_add, function(username) list(name = username)) )

watchers_data <- toJSON(watchers_data, auto_unbox = TRUE) 


add_watchers_request <- POST( url = watchers_url, add_headers("Authorization" = paste(username, token), "Content-Type" = "application/json"), body = watchers_data)


when I print the status code its 400. And as per the documentation, it should come 200 for successfully adding watchers to issue ticket. Please let me know what I am doing wrong over here.

0 answers

Suggest an answer

Log in or Sign up to answer