REST API: Delete Jobcode Assignments

Last Updated: May 22, 2015

Description

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

Resource Information

HTTP Method DELETE
Endpoint https://rest.tsheets.com/api/v1/jobcode_assignments
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 Jobcode Assignment
Permissions You must be a group manager of the user you're removing assignments from, be an admin, or have the manage_users permission.

Available Filters

If no filters are specified at all, no jobcode assignments are deleted.

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

Status Codes

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

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

Examples

Request to delete four jobcode assignments. 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/jobcode_assignments?ids=56788052,58078296, ,1234"


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

{
 "results": {
  "jobcode_assignments": {
   "56788052": {
    "_status_code": 200,
    "_status_message": "OK, deleted",
    "id": 56788052,
   },
   "58078296": {
    "_status_code": 200,
    "_status_message": "OK, deleted",
    "id": 58078296,
   },
   "": {
    "_status_code": 417,
    "_status_message": "Expectation Failed!",
    "_status_extra": "That id is not found in the database",
    "id": "",
   },
   "1234": {
    "_status_code": 417,
    "_status_message": "Expectation Failed!",
    "_status_extra": "Oops! You don't have permission to remove jobcodes for that user.",
    "id": "1234",
   }
  }
 }
}