REST API: Edit Schedule Events

Last Updated: May 16, 2017

Description

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

Resource Information

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

Schedule Event Properties

When editing an event, you must uniquely identify the event by passing in the event id. All other properties defined on a schedule event 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.

Optional Request Properties

team_events:
String. 'base' or 'instance'. Default is 'instance'. If 'instance' is specified, supplemental events that are edited for multiple users will be returned as individual single events for each assigned user. If 'base' is specified, supplemental events that are edited for multiple users will be returned as one combined event for all assignees.

Status Codes

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

_status_code Meaning
200 OK. Event was edited successfully.
201 Fulfilled. Event was edited successfully and additional events that were edited as a result are included in the supplemental data section of the response.
403 Permission Denied. The requesting user did not have high enough manage schedule permissions to edit the event.
417 Expectation Failed. Something was wrong or missing with the properties supplied for this event. See the _status_extra value for more detail.

Examples

Edit the title of an event.

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

## contents of the post_data.json file are:
{
    "data":
    [
        {
            "schedule_calendar_id":5,
            "id": 2816375,
            "title":"changed title"
        }
    ],
    "team_events": "base"
}



## RESPONSE
HTTP/1.1 200 OK
Content-Type: application/json
{
 "results": {
  "schedule_events": {
   "1": {
   "_status_code": 200,
    "_status_message": "Updated",
    "id": 2816375,
    "user_id": 11,
    "unassigned": false,
    "schedule_calendar_id": 5,
    "jobcode_id": 0,
    "all_day": false,
    "start": "2016-12-05T16:00:00+00:00",
    "end": "2016-12-05T18:00:00+00:00",
    "active": true,
    "draft": true,
    "timezone": "UTC",
    "title": "changed title",
    "notes": "",
    "color": "#888888",
    "last_modified": "2016-12-07T18:12:29+00:00",
    "created": "2016-12-07T17:47:37+00:00",
    "customfields": "",
    "assigned_user_ids": "11,1365",
    "location": ""
   }
  }
 },
 "supplemental_data": {
  "users": {
   "11": {
    "id": 11,
    "first_name": "Joni",
    "last_name": "Smith",
    ...
    }
   }
  },
  "calendars": {
   "5": {
    "id": "5",
    ...
   }
  }
 }
}