ShiftController

WordPress Shift Scheduling Plugin

Find available employees

Since version 4.9.48.

ShiftController provides a REST API endpoint to find employees available for shift scheduling during a certain date and time range in certain schedule calendars.

Please note that each REST API request requres a valid X-WP-ShiftController-AuthCode header. You can find the value that is unique to your website in ShiftController > Administration > REST API form. You can also change that API key to any other value. In the examples on this page we use 123.

To query employees that are available for scheduling please make a GET request to the following address:

GET /shiftcontroller/v4/available-employees

Headers

X-WP-ShiftController-AuthCode: 123

Arguments

calendar_id

This calendar argument lets you provide one or several IDs of schedule calendars that you are interested to find available workers for. If no argument is provided, it will query all active calendars that have their type set to Shift. Otherwise, you can provide one or several id values to limit your search to specific calendars. If you want to find employees that are available for time off too, just pass in the id of one or more time off calendars. You can find the ID values for calendars in ShiftController > Administration > Calendars page.

Examples

GET https://www.yoursite.com/wp-json/shiftcontroller/v4/available-employees

It will return all workers in your roster available for all active Shift calendars for today.

GET https://www.yoursite.com/wp-json/shiftcontroller/v4/available-employees?calendar_id=123

It will return all employees available for today in the calendar with id = 123.

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

It will return all employees available for today in the calendar with id = 123 or in the calendar with id = 456.

from

The start time argument lets you provide the time when to start looking for available employees. You can use the exact time in the YYYYMMDDHHMM format, for example 202411210800. Or you can supply just the date in the YYYYMMDD format, for example 20241121, so it will perform the search from the start of the day, 0 AM / 00:00. If no argument is provided, it will use the beginning of today.

to

The end time argument lets you provide the end of the time range where to look for available employees. You can use the exact time in the YYYYMMDDHHMM format, for example 202411212000. Or you can supply just the date in the YYYYMMDD format, for example 20241121, so it will perform the search till the end of the day, 12 AM / 24:00. If no argument is provided, it will take the start value and add 24 hours to it. For example, if you use 20241121 as the start, and provide no end argument, it will search all 24 hours of today. if you use 202411210800 as the start, and provide no end argument, it will search from 8am of today till 8am of tomorrow.

Examples

GET https://www.yoursite.com/wp-json/shiftcontroller/v4/available-employees

It will return all employees available for all active Shift calendars within all 24 hours of today.

GET https://www.yoursite.com/wp-json/shiftcontroller/v4/available-employees?from=202411210900&to=202411211430

It will return all employees available for all active Shift calendars from 9am (09:00) to 2:30pm (14:30) of the specified date.

Return value

A successful request returns an array with the following keys:

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"
    }
  ]
}