Allows for the insertion or updating of a collection of calendar events. Maximum request size: 1000 calendar events per batch. If any of the calendar events are invalid, no updates are made and a collection of error results is returned.

PUT /api/v2/calendar-events/batch

Parameters for One Calendar Event

Name

Type

Description

ExternalId

string

Required. School’s unique identifier for the calendar event. If provided, the existing calendar event, if found, will be updated. If an existing calendar event is not found, the event will be inserted.

UserId

64 bit int

Required. 12Twenty’s identifier for the user (e.g. student). If calendar event with specified ExternalId is owned by another user, it will not be updated.

TypeId

int

Required. The type of calendar event. Options: Class = 1, Interview = 2, Other = 3

StartTime

date/time

Required. The UTC start time of the calendar event in ISO 8601 format.

EndTime

date/time

Required. The UTC end time of the calendar event in ISO 8601 format. Must be after StartTime.

Title

string

Required. The title of the calendar event


Example Request

[{
 "ExternalId": "xyz-123",
 "UserId": 124,
 "TypeId": 1,
 "StartTime": "2018-06-10T20:00:00Z",
 "EndTime": "2018-06-10T22:00:00Z",
 "Title": "Course FMAR2: Fin. Meas., Analysis & Rept. 2"
},
{
 "ExternalId": "xyz-124",
 "UserId": 124,
 "TypeId": 1,
 "StartTime": "2018-06-10T20:00:00Z",
 "EndTime": "2018-06-10T22:00:00Z",
 "Title": "Course FMARX: Misc"
}]

Response

A collection of results. If errors exist, the error messages for calendar events that encountered errors are returned. A 12Twenty identifier is returned for each calendar event that was successfully processed.

Example Response with Errors

HTTP/1.1 200 OK
Cache-Control: no-cache
Pragma: no-cache
Content-Type: application/json; charset=utf-8
Expires: -1
Date: Wed, 15 Apr 2015 16:49:02 GMT
[
 {
     "ExternalId": "xyz-123",
     "ErrorMessage": "Event 'load-test-10' is owned by another student (20100323).",
     "IsSuccessful": false
 },
 {
     "ExternalId": "xyz-124",
     "ErrorMessage": "StartTime must be before EndTime",
     "IsSuccessful": false
  }
]

Example Successful

[
  {
    "Id": 270067010486464,
    "ExternalId": "test-1",
    "ErrorMessage": null,
    "IsSuccessful": true
  }
]