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=20241121
GET https://www.yoursite.com/wp-json/shiftcontroller/v4/shifts?from=202411210900&to=202411211430&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: 202411210800 end: 202411211430 status_id: publish
if you have custom fields
misc11: orange misc12: 321
If it's ok, it will return 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: 202411210900 end: 202411211530
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 All Calendars
Since version 4.9.68.
GET /shiftcontroller/v4/calendars
Headers
X-WP-ShiftController-AuthCode: 123
Examples
GET https://www.yoursite.com/wp-json/shiftcontroller/v4/calendars
Example return
[ { "id": "12", "title": "Barista", "type": "shift", "active": "1" }, { "id": "13", "title": "Server", "type": "shift", "active": "0" }, { "id": "14", "title": "Holidays", "type": "timeoff", "active": "0" } ]
Get All Employees
Since version 4.9.68.
GET /shiftcontroller/v4/employees
Headers
X-WP-ShiftController-AuthCode: 123
Examples
GET https://www.yoursite.com/wp-json/shiftcontroller/v4/employees
Example return
[ { "id": "523", "title": "Alice", "email": "alice@host.local", "username": "alice" }, { "id": "527", "title": "Eve", "email": "eve@host.local", "username": "eve" } ]
Get Calendars For Employee
Since version 4.9.68.
GET /shiftcontroller/v4/employees/<id>/calendars
Headers
X-WP-ShiftController-AuthCode: 123
Examples
GET https://www.yoursite.com/wp-json/shiftcontroller/v4/employees/123/calendars
Get Employees Eligible For Calendar
Since version 4.9.68.
GET /shiftcontroller/v4/calendars/<id>/employees
Headers
X-WP-ShiftController-AuthCode: 123
Examples
GET https://www.yoursite.com/wp-json/shiftcontroller/v4/calendars/654/employees
Add Employee To Calendar
Since version 4.9.68.
POST /shiftcontroller/v4/calendars/<cid>/employees/<eid>
POST /shiftcontroller/v4/employees/<eid>/calendars/<cid>
Headers
X-WP-ShiftController-AuthCode: 123
Examples
POST https://www.yoursite.com/wp-json/shiftcontroller/v4/calendars/654/employees/123
POST https://www.yoursite.com/wp-json/shiftcontroller/v4/employees/123/calendars/654
Remove Employee From Calendar
Since version 4.9.68.
DELETE /shiftcontroller/v4/calendars/<cid>/employees/<eid>
DELETE /shiftcontroller/v4/employees/<eid>/calendars/<cid>
Headers
X-WP-ShiftController-AuthCode: 123
Examples
DELETE https://www.yoursite.com/wp-json/shiftcontroller/v4/calendars/654/employees/123
DELETE https://www.yoursite.com/wp-json/shiftcontroller/v4/employees/123/calendars/654
Get Employee
Since version 4.9.68.
GET /shiftcontroller/v4/employees/<id>
Headers
X-WP-ShiftController-AuthCode: 123
Examples
GET https://www.yoursite.com/wp-json/shiftcontroller/v4/employees/123
Get Employee By User Id
Since version 4.9.68.
GET /shiftcontroller/v4/users/<id>/employee
Headers
X-WP-ShiftController-AuthCode: 123
Examples
GET https://www.yoursite.com/wp-json/shiftcontroller/v4/users/321/employee
Create Employee
Since version 4.9.68.
POST /shiftcontroller/v4/employees
Headers
X-WP-ShiftController-AuthCode: 123
Arguments
title
user_id optional
description optional
Either title or user_id required. If user_id is given, it will link the new employee to this WordPress user. If user_id is given without the title, it will create a new employee with this WordPress user's full name as employee's title and link this employee to this user.
Examples
POST https://www.yoursite.com/wp-json/shiftcontroller/v4/employees title: James
If it's ok, it will return the id of the new employee. Otherwise error messages will be given.
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=202411210900&to=202411211430
GET https://www.yoursite.com/wp-json/shiftcontroller/v4/available-employees?from=20241121&calendar_id=123
GET https://www.yoursite.com/wp-json/shiftcontroller/v4/available-employees?calendar_id[]=123&calendar_id[]=456
Example return
{ "from": "202411210900", "to": "202411211430", "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.