ShiftController

WordPress Shift Scheduling Plugin

REST API

Since version 4.8.4.

ShiftController provides a number of REST API endpoints to query and update its shifts database.

Please note that each call requres the X-WP-ShiftController-AuthCode header set to the value from your ShiftController Administration > REST API form. In the examples on this page we use 123.

Get Shifts

GET /shiftcontroller/v4/shifts

Headers

X-WP-ShiftController-AuthCode: 123

Arguments

calendar_id (Calendar Id)
employee_id (Employee Id)
from (From Date, YYYYMMDD / From Date Time, YYYYMMDDHHMM)
to (To Date, YYYYMMDD / To Date Time, YYYYMMDDHHMM)
status_id (publish, draft)

Optional Arguments since version 4.9.22.

You have custom fields, you can also pass in their names and values to filter the results.

Examples

GET https://www.yoursite.com/wp-json/shiftcontroller/v4/shifts
GET https://www.yoursite.com/wp-json/shiftcontroller/v4/shifts?calendar_id=11&from=20240329
GET https://www.yoursite.com/wp-json/shiftcontroller/v4/shifts?from=202403290900&to=202403291430&status_id=draft

Since version 4.9.22.

GET https://www.yoursite.com/wp-json/shiftcontroller/v4/shifts?calendar_id=11&misc123=CustomFieldValue

Get Shift

GET /shiftcontroller/v4/shifts/<id>

Headers

X-WP-ShiftController-AuthCode: 123

Examples

GET https://www.yoursite.com/wp-json/shiftcontroller/v4/shifts/123

Delete Shift

DELETE /shiftcontroller/v4/shifts/<id>

Headers

X-WP-ShiftController-AuthCode: 123

Examples

DELETE https://www.yoursite.com/wp-json/shiftcontroller/v4/shifts/123

Create Shift

POST /shiftcontroller/v4/shifts

Headers

X-WP-ShiftController-AuthCode: 123

Arguments

calendar_id (Calendar Id)
employee_id (Employee Id)
start (Start Date Time, YYYYMMDDHHMM)
end (End Date Time, YYYYMMDDHHMM)
status_id (publish, draft)
conflict (Set to 1 to allow creation of shifts with conflicts) optional

If you have custom fields in this calendar, then you can add them too as miscXXX where XXX is the field id (see Administration > Calendars > Custom Fields):

misc11
misc12

Examples

POST /shiftcontroller/v4/shifts
calendar_id: 11
employee_id: 22
start: 202403290800
end: 202403291430
status_id: publish

if you have custom fields

misc11: orange
misc12: 321

If success, it returns the id of the new shift. Otherwise error messages will be given.

Update Shift

PUT /shiftcontroller/v4/shifts/<id>

Headers

X-WP-ShiftController-AuthCode: 123

Arguments

calendar_id (Calendar Id) optional
employee_id (Employee Id) optional
start (Start Date Time, YYYYMMDDHHMM) optional
end (End Date Time, YYYYMMDDHHMM) optional
status_id (publish, draft) optional
conflict (Set to 1 to allow creation of shifts with conflicts) optional

If you have custom fields in this calendar, then you can add them too as miscXXX where XXX is the field id (see Administration > Calendars > Custom Fields):

misc11
misc12

Examples

PUT https://www.yoursite.com/wp-json/shiftcontroller/v4/shifts//123
start: 202403290900
end: 202403291530
PUT https://www.yoursite.com/wp-json/shiftcontroller/v4/shifts//123
employee: 22
PUT https://www.yoursite.com/wp-json/shiftcontroller/v4/shifts//123
status_id: publish

Get Available Employees

Since version 4.9.48.

GET /shiftcontroller/v4/available-employees

Headers

X-WP-ShiftController-AuthCode: 123

Arguments

calendar_id (Calendar Id) optional
default: all shift-type calendars
from (Start Date Time, YYYYMMDDHHMM) optional
default: beginning of today
to (End Date Time, YYYYMMDDHHMM) optional
default: one day from the start

Examples

GET https://www.yoursite.com/wp-json/shiftcontroller/v4/available-employees
GET https://www.yoursite.com/wp-json/shiftcontroller/v4/available-employees?from=202403290900&to=202403291430
GET https://www.yoursite.com/wp-json/shiftcontroller/v4/available-employees?from=20240329&calendar_id=123
GET https://www.yoursite.com/wp-json/shiftcontroller/v4/available-employees?calendar_id[]=123&calendar_id[]=456

Example return

{
  "from": "202403290900",
  "to": "202403291430",
  "employees": [
    {
      "id": "523",
      "title": "Alice",
      "email": "alice@host.local",
      "username": "alice"
    },
    {
      "id": "527",
      "title": "Eve",
      "email": "eve@host.local",
      "username": "eve"
    }
  ]
}

Please refer to this page for a more detailed description of this API.