$value ){ $option_name = $app . '_' . $key; $value = sanitize_text_field( $value ); update_option( $option_name, $value ); } } if( ! isset($_POST[$app]['enabled']) ){ $k = $app . '_enabled'; $value = 0; update_option( $k, $value ); } } // $this->initOption(); $current = array(); $current['enabled'] = get_option( $app . '_enabled', 1 ); $current['auth_code'] = get_option( $app . '_auth_code', '' ); $startUrl = '/shiftcontroller/v4/'; // spaghetti starts here ?>
app ); ?>

Get Shifts

GET

__Headers__

X-WP-ShiftController-AuthCode:

__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)

root(); $cfieldsQuery = $f->make('SH4_CFields_Query'); $cfields = $cfieldsQuery->read(); ?>

__Optional Arguments__

getName(); ?> (getLabel(); ?>)

__Examples__

GET 
GET ?calendar_id=11&from=
GET ?from=0900&to=1430&status_id=draft

__Get Shift__

GET

__Headers__

X-WP-ShiftController-AuthCode:

__Examples__

GET /123

__Delete Shift__

DELETE

__Headers__

X-WP-ShiftController-AuthCode:

__Examples__

DELETE /123

__Create Shift__

POST

__Headers__

X-WP-ShiftController-AuthCode:

__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__

__Examples__

POST 

calendar_id: 11
employee_id: 22
start: 0800
end: 1430
status_id: publish

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

__Update Shift__

PUT

__Headers__

X-WP-ShiftController-AuthCode:

__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__

__Examples__

PUT /123
start: 0900
end: 1530
PUT /123
employee_id: 22
PUT /123
status_id: publish

__Get Available Employees__

GET

__Headers__

X-WP-ShiftController-AuthCode:

__Arguments__

calendar_id (__Calendar Id__) __optional__
__default value__: __all shift-type calendars__
from (__Start Date Time__, YYYYMMDDHHMM) __optional__
__default value__: __beginning of today__
to (__End Date Time__, YYYYMMDDHHMM) __optional__
__default value__: __one day from the start__

__Examples__

GET 
GET ?from=0900&to=1430
GET ?from=&calendar_id=123
GET ?calendar_id[]=123&calendar_id[]=456

__Example return__

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