Skip to content

Instantly share code, notes, and snippets.

@oadam
Last active March 14, 2016 14:19
Show Gist options
  • Save oadam/8c7758c83aa8f8c0a824 to your computer and use it in GitHub Desktop.
Save oadam/8c7758c83aa8f8c0a824 to your computer and use it in GitHub Desktop.
JIRA worklog API
function logWork(issueId, year, month, day, timespent) {
//issueId: "RTJO-XXX"
//year: 2015, 03, 15)
//month: 3
//day: 15
//timespent: "1d"
jQuery.ajax({
url: "/rest/api/2/issue/" + issueId + "/worklog",
type: "POST",
dataType: "json",
contentType: "application/json",
async: false,
data: JSON.stringify({
started: year + "-" + month + "-" + day + "T09:11:00.000+0000",
timeSpent: timespent
})
});
}
//can be used like that :
/*for(var i=0;i<4;i++){
logWork('RJTO-19', 2015, 09, 1+7*i, '1d');
logWork('RJTO-19', 2015, 09, 3+7*i, '1d');
logWork('RJTO-19', 2015, 09, 4+7*i, '0.5d');
}*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment