Hello
I want to increase the time spend on an issue when the issue is changing its status. For that purpose, I'm using script runner post function with following script:
def issueKey = issue.id
def result = put("/rest/api/3/issue/${issueKey}/worklog")
.header('Content-Type', 'application/json')
.body([
timeSpent: '2h'
]).asString()
But always as a result I'm getting "status: 405 - Method Not Allowed".
It happens no matter whether I run it as a ScriptRunner Add-On User or Initiating User.
I've tried similar, external python script with the same user and it worked. When instead of timeSpent I've tried elapsedTime it also worked properly.
Anyone can help, where am I doing a mistake? Or maybe it's not possible to update the timeSpent from scriptRunner?
hi @Zbyszek the problem is that you are using "put" method to update worklog, but it would work only to update existing worklog.
I will try to describe it little bit. You have an issue object and every log work operation creates new worklog entry, so you can have multiple worklogs on one issue.
If it is ok just to add new worklog, you can use:
def result = post("/rest/api/3/issue/${issueKey}/worklog")
.header('Content-Type', 'application/json')
.body([
timeSpent: '1h'
]).asString()
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.