REST API: Edit Custom Field Items

Last Updated: June 04, 2015

Description

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

Resource Information

HTTP Method PUT
Endpoint https://rest.tsheets.com/api/v1/customfielditems
Authentication Token header required. See authentication section
Request format json object. Pass an array of customfielditem objects as the value to a 'data' property (see example below).
Response format json
Response object Custom Field Item

Custom Field Item properties

When editing a customfielditem, you must uniquely identify the customfielditem by passing in its id property. All other properties defined on a Custom Field Item object may be passed in to the request with a new value in order to change it. If the value passed in is the same as it was previously, or if a particular property is not passed in at all, it will be ignored.

Status Codes

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

_status_code Meaning
200 OK. Customfielditem was edited successfully.
417 Expectation Failed. Something was wrong or missing with the properties supplied for this customfielditem. See the _status_extra value for more detail.

Examples

Change some information for each of these customfielditems.

## REQUEST
curl -H "Authorization: Bearer <Access-Token>" -X PUT -i -H "Content-Type: application/json" -d @customfielditems_edit.json "https://rest.tsheets.com/api/v1/customfielditems"

## contents of the customfielditems_edit.json file are:
{
 "data":
  [
    {
     "id":3085064,
     "customfield_id":19142,
     "active":true,
     "short_code":"por",
     "name":"Porsche"
    },
    {
     "id":3085066,
     "customfield_id":19142,
     "active":false,
     "short_code":"merc",
     "name":"Mercruiser"
    }
  ]
}



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

{
 "results": {
  "customfielditems": {
   "1": {
    "_status_code": 200,
    "_status_message": "Updated",
    "id": 3085064,
    "customfield_id": 19142,
    "active": true,
    "short_code": "por",
    "name": "Porsche"
   },
   "2": {
    "_status_code": 200,
    "_status_message": "Updated",
    "id": 3085066,
    "customfield_id": 19142,
    "active": false,
    "short_code": "merc",
    "name": "Mercruiser"
   }
  }
 },
 "supplemental_data": {
  "customfields": {
   "19142": {
    "id": 19142,
    "required": true,
    "type": "timesheet",
    "ui_preference": "managed-list",
    "short_code": "cf1",
    "regex_filter": "",
    "name": "Custom Field 1",
    "last_modified": "2013-07-23T23:09:14+00:00",
    "created": "2013-07-23T23:09:14+00:00"
   }
  }
 }
}