REST API: Delete Files

Last Updated: July 27, 2018

Description

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

Resource Information

HTTP Method DELETE
Endpoint https://rest.tsheets.com/api/v1/files
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 File

Available Filters

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

ids:
String. Comma separated list of file ids you'd like to delete

Status Codes

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

_status_code Meaning
200 OK. File was deleted successfully.
417 Expectation Failed. Something went wrong for this file. See the _status_extra value for more detail.

Examples

Request to delete four files. Two resulting in success and two resulting in an error.

## REQUEST
curl -H "Authorization: Bearer <Access-Token>" -X DELETE -i "https://rest.tsheets.com/api/v1/files?ids=129526,129524,13455,89999"


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

{
 "results": {
  "files": {
   "129526": {
    "_status_code": 200,
    "_status_message": "OK, deleted",
    "id": "129526"
   },
   "129524": {
    "_status_code": 200,
    "_status_message": "OK, deleted",
    "id": "129524"
   },
   "13455": {
    "_status_code": 404,
    "_status_message": "File not found!",
    "id": "13455"
   },
   "89999": {
    "_status_code": 404,
    "_status_message": "File not found!",
    "id": "89999"
   }
  }
 }
}