How to add log work time spent via REST

Irantha Jayasekara May 27, 2013

Im working on C# application, I need to REST method to update log work (time spent) on a particular issue.
how can I achieve this?

Thanks and regards,

Irantha

1 answer

0 votes
Andy Heinzer
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
September 23, 2020

Hi,

The process to add a worklog to an issue in Jira via REST is pretty straightforward in general, but I have to admit that I am not well versed in the use of C# programming language. 

Each of those documents have examples of using this endpoint.  For the Cloud version there are curl, php, node.js, java, and python specific syntax listed there that can help.  I am not sure of the exact C# syntax here, but it would have to follow the same headers/endpoint/payload being sent as the other examples.

For example, if you're using Jira Cloud, basic auth, and curl, you could send a request such as

curl --request POST \
  --url 'https://your-domain.atlassian.com/rest/api/3/issue/{issueIdOrKey}/worklog' \
  --header 'Authorization: Basic [base64encodedstring]' \
  --header 'Accept: application/json' \
  --header 'Content-Type: application/json' \
  --data '{
  "timeSpentSeconds": 12000,
  "started": "2020-09-23T07:30:36.640+0000"
}'

Of course you would need to substitute your URL, and IssueKey to make this work, but this is how it can be done. I also ran across another thread such as https://community.atlassian.com/t5/Answers-Developer-Questions/Using-c-to-access-jira-cloud-issues/qaq-p/535374 in which another user found the use of RestSharp to be helpful in being able to make such REST calls from C Sharp.

I hope this helps.

Andy

Suggest an answer

Log in or Sign up to answer