Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

worklog - API

Issam Gebara
Contributor
January 21, 2023

1- is it possible to delete a worklog?

2- is it possible to update a worklog details i.e spent time?

3- how we can pull the updated worklog via API to get the new/updated worklog?

3 answers

1 accepted

0 votes
Answer accepted
Gracjan Wesołowski _HeroCoders_
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.
January 23, 2023

Hi @Issam Gebara 

Welcome to the community!

The endpoint API to delete the worklogs is: 

DELETE /rest/api/3/issue/{issueIdOrKey}/worklog/{id} 

CURL example:

curl --request DELETE \
--url 'https://your-domain.atlassian.net/rest/api/3/issue/{issueIdOrKey}/worklog/{id}' \
--user 'email@example.com:<api_token>'
Different examples can be found in the documentation sent above.

The endpoint for the update is:

PUT /rest/api/3/issue/{issueIdOrKey}/worklog/{id}

 For the usage possibilities, you can review the documentation here. 

As for the third question, it is possible to pull the worklogs using the endpoint:

GET /rest/api/3/worklog/updated 

curl https://your-jira-url.atlassian.net/rest/api/3/worklog/updated?expand=properties \
> -u greg@example.com:gregs_api_token
In the same way, you can use the since parameter to show data from the specific timestamp.
curl https://your-jira-url.atlassian.net/rest/api/3/worklog/updated?expand=properties&since=1672527600
-u greg@example.com:gregs_api_token
Using this you receive JSON data containing worklog properties.

The details about this endpoint can be found here.

I hope that helps.

Cheers!

Gracjan

Issam Gebara
Contributor
January 31, 2023

thank you for your reply, in fact i have used the /rest/api/3/worklog/list?expand=properties  to provide the full list of worklogs , however am not able to importing the data by ID or By id and Issue ID or by ID/Issue ID and Started Date

 

However also this API missing the Issue Key, so not sure how to resolve the duplication, but mainly what is the primary key of this table ?

check the below SSIS Issue received

 System.Exception: Duplicate key found in source data. To avoid this error Set Duplicate Handling on Advanced Tab or remove duplicate from source data and try again. ERROR: Violation of PRIMARY KEY constraint 'PK_Worklogs_Temp'. Cannot insert duplicate key in object 'dbo.JIRA_Worklogs_Temp'. The duplicate key value is (11274, 21170, Oct 27 2022 3:00PM).
The statement has been terminated.

0 votes
Sheikh Faiyaz
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!
August 29, 2023

Hey guys,

The since parameter in query string isn't working for me. It always return workload from the beginning of time of the instance. 

Endpoint: 

rest/api/3/worklog/updated?since=1693245600

Need help to figure this out. I need to pull the all the worklog given yesterday.

0 votes
Alex Koxaras _Relational_
Community Champion
January 21, 2023

Hi @Issam Gebara and welcome to the community,

  1. Yes, you have to have either the "delete own worklog" or the "delete all worklogs" project permission
  2. Yes, you have to have either the "edit own worklog" or the "edit all worklogs" project permission
  3. You may find this link helpful about all the worklog endpoints https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issue-worklogs/#api-group-issue-worklogs

Let me know if the above helps. 

Issam Gebara
Contributor
January 21, 2023

Thank you @Alex Koxaras _Relational_ for your quick feedback , i have check the project permission and see the Edit/ Delete Own worklog is enabled, so let me clarify what i have done:

I have designed an SSIS job to pull the worklog using Zappy's SSIS PowerPack,what i need to do is perform an incremental worklog logs and main needs is to get the the deleted worklogs / created-updated worklogs

so i get the last updated date from my stored DB Data and based on this i called the API with a JQL worklogdate >= "-4d" where 4 can be 5 or 1 ...however in the reply am not getting worklog as response from the API and am receiving CreatedDate/Updated that belongs to 1 month back

after troubleshooting the fiddler JSON Response i came to know that the API will give all the worklogs when i.e a comment is being added but it does not filter on the recent worklog updated so my inquiry is how i can get only the updated worklog data and not the whole time entries specified on a specific issue id

 

what is the formula or expression that i can use in JQL to get only the created / updated time entries? 

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events