REST API: Delete Timesheets

Last Updated: March 29, 2017

Description

Delete one or more timesheets in your company. We will handle batches of up to 50 timesheets at a time. More than 50 timesheets will result in a 413 - Request entity too large error.

Resource Information

HTTP Method DELETE
Endpoint https://rest.tsheets.com/api/v1/timesheets
Authentication Token header required. See authentication section
Request format Everything is handled through the request uri on a DELETE, the same as a GET.
Response format json
Response object Timesheet

Available Filters

If no filters are specified at all, no timesheets are deleted.

ids:
optional
Integer. Comma separated list of timesheet ids you'd like to delete. Note that timesheets are actually deleted, not archived.

Status Codes

Each timesheet that is deleted will come back with a _status_code and _status_message that will indicate whether the timesheet was deleted successfully. If there was a problem deleting a timesheet, there may also be an additional field, _status_extra, which will contain more details about the failure.

_status_code Meaning
200 OK. Timesheet was deleted successfully.
404 Not Found. Timesheet either has never existed or has already been deleted.
409 Conflict. Because a conflict would have resulted in the change requested, the timesheet was not modified. The unmodified timesheet's properties will be included in the response, to make it easy to revert to the unmodified version of the timesheet.
417 Expectation Failed. Something went wrong for this timesheet. See the _status_extra value for more detail.

Examples

Delete two timesheets.
Note: The code example below references timesheet ids that will need to be substituted with ids associated with your TSheets account.

## REQUEST
curl -H "Authorization: Bearer <Access-Token>" -X DELETE -i "https://rest.tsheets.com/api/v1/timesheets?ids=135694294,135694494"


## RESPONSE
HTTP/1.1 200 OK
Content-Type: application/json

{
 "results": {
  "timesheets": {
   "135694294": {
    "_status_code": 200,
    "_status_message": "OK, deleted",
    "id": "135694294"
   },
   "135694494": {
    "_status_code": 200,
    "_status_message": "OK, deleted",
    "id": "135694494"
   }
  }
 }
}