Update specified TimeBlocks. Uses boolean query "reqAddifnotfound" to add or ignore the specified TimeBlock if it does not exist in the system. Uses Key-Value identifiers TimeBlockID or ExternalID with identifier ScheduleID.

Query Parameters

ParameterTypeRequiredNotes
reqAddifnotfoundbooleanTrueAccepts an integer value.
ScheduleIDintegerTrue1 = Current Schedule, 2 = Recurring Schedule, 7 = Attendance, ScheduleID for Templates can be accessed using the getTimeBlockEditors function

Parameters

ParameterTypeRequiredNotes
Key string True Denotes how the item will be indexed: TimeBlockID or ExternalID
KeyVal string True The actual index of the item: TimeBlockID or ExternalID
Notes string False
StartTime time True* *Only required if "reqAddifnotfound" is True or if updating the DayNo in the Recurring Schedule. Accepts a time value for recurring and a DateTime value for current
EndTime time True* *Only required if "reqAddifnotfound" is True or if updating the DayNo in the Recurring Schedule. Accepts a time value for recurring and a DateTime value for current
StartDateTime datetime True* *Only required if "reqAddifnotfound" is True and attempting to update the Current Schedule (ScheduleID=1)
EndDateTime datetime True* *Only required if "reqAddifnotfound" is True and attempting to update the Current Schedule (ScheduleID=1)
UserID integer True* *Only required if "reqAddifnotfound" is True
ExternalID integer False Must be unique
NumHours float False Only accepted if OverrideNumHours is both present and set to True
OverrideNumHours boolean True* Only Required if Editing NumHours. Accepts an integer value.
StartDayNo int True* Only for use if updating in Recurring Schedule
Color string False Set the override color. Accepts a properly-formatted 6-digit hexadecimal color
DepartmentID integer False
AreaID integer False
TaskID integer False
TimeOfDayID integer False
TimeOffReasonID integer False
TimeOffAccountID integer False

Example Query

POST https://api.workschedule.net/WS.exe?Module=API&SessionID=123&SP=12345678&Method=updateTimeBlocks&reqAddifnotfound=1&ScheduleID=1

Sample JSON Input

  [
 {
  "Key": "TimeBlockID",
  "KeyVal": "1234",
  "Notes": "This is a test add",
  "OverrideNumHours": "1",
  "NumHours": "12",
  "StartDateTime": "6-16-2014 9:00 AM",
  "EndDateTime": "6-16-2014 5:00 PM",
  "UserID": "1"
 },

 {
  "Key": "ExternalID",
  "KeyVal": "9876",
  "Notes": "This is a test update",
  "OverrideNumHours": "1",
  "NumHours": "24",
  "UserID": "1",
  "DepartmentID": "1",
  "StartDateTime": "6-16-2014 9:00 AM",
  "EndDateTime": "6-16-2014 5:00 PM"
 }

]  

JSON Response

  {
 "ErrorMessage": "Success",
 "ItemResponses": [
  {
   "ErrorMessage": "Success",
   "ItemNo": "1",
   "ErrorCode": "0"
  },{
   "ErrorMessage": "Success",
   "ItemNo": "2",
   "ErrorCode": "0"
  }],
 "Items": [],
 "ErrorCode": "0"
}  

Resource Information

Response Format JSON
Request Type POST