How to Mass Delete TimeEntries
Introduction
This guide is aimed at helping you mass delete TimeEntries. It can help you reset clear TimeEntries after an incorrect import or any problem encountered when updating TimeEntries.
Prerequisites
You will need:
- (required) Your domain name
{yourDomain}
, eg: “https://myawesomecompany.ilucca.net”. - (required) An API key
{apiKey}
that has TimeEntries editing rights to the given owners.
Guide
1. Identify TimeEntries
Submitted TimeEntries cannot be deleted. Once a timesheet has been submitted, and whether or not it is approved, the TimeEntries it contains can no longer be modified or deleted. You may want to first reject the timesheet, and there’s a guide for this.
Retrieving TimeEntries is achieved through the /api/v3/timeentries
endpoint. Its API reference can be found here.
In order to isolate the TimeEntries that need to be deleted, the most common filters are:
?ownerId=1,2,...
: filter on the user(s).?startsAt=between,2022-01-01,2022-O2-01
: filter on the TimeEntry date.?unit=0,1,2
: filter on the TimeEntry unit.
Please page your request. Requests aimed at retrieving a large set of resources should be paged. You can read more about paging here.
The request should look like this:
If timesheetId is not null.
If the timesheetId
of the returned TimeEntries is not null, then it
belongs to a submitted timesheet and cannot be deleted as long as said
timesheet is not rejected.
2. Delete TimeEntries
Deleting TimeEntries can be done through a DELETE request on the /api/v3/timeentries
endpoint. The array of TimeEntries to delete must be passed in the request body.
Please refer to the API reference.
Was this page helpful?