Api doc


SDK's


Api Modules

schedule.shift

Management of individual shifts.



Supported Methods:

GET
Params
  • token (Required): valid token
  • id (Required): integer
  • detailed: integer
  • do_not_initiate_conflicts: integer
  • filter_by_skill: integer


CREATE
Params
  • token (Required): valid token
  • start_time (Required): time
  • end_time (Required): time
  • start_date (Required): date
  • end_date (Required): date
  • schedule: integer
  • employee_id: integer
  • type: integer
  • needed: integer
  • notes: varchar
  • title: varchar
  • confirmed: varchar
  • location: integer
  • filter_by_skill: integer


UPDATE
Params
  • token (Required): valid token
  • id (Required): integer
  • trade_accept: integer
  • approve_overtime: integer
  • employee_id: integer
  • schedule: varchar
  • type: integer
  • needed: integer
  • start_time: time
  • end_time: time
  • start_date: date
  • end_date: date
  • notes: varchar
  • title: varchar
  • confirmed: integer
  • add: varchar
  • remove: varchar
  • detailed: varchar
  • location: varchar
  • force: enum (0, 1)
  • repeat: integer
  • repeat_until: date
  • repeat_staff: enum (, 0, 1, 2)
  • repeat_custom: varchar
  • repeat_cycle: enum (day, week)
  • repeat_cycle_step: integer
  • repeat_cycle_on: integer
  • update_series: enum (1, 2, 3)
  • update_staff: enum (0, 1)
  • update_time: enum (0, 1)
  • update_type: enum (0, 1)
  • update_notes: enum (0, 1)
  • update_schedule: enum (0, 1)
  • update_tasks: enum (0, 1)
  • copy_to: date
  • restore: enum (0, 1)
  • addOnCall: varchar
  • removeOnCall: varchar
  • do_not_initiate_conflicts: integer
  • filter_by_skill: integer


DELETE
Params
  • token (Required): valid token
  • id (Required): integer
  • rule: enum (all, following)


Documentation

GET
Retrieves an individual shift.
Level 5 is required (all users can fetch this module)

--

Parameters:

  1. "id": required //Shift id (integer)
  2. "detailed": accepted //Detailed (integer)
  3. /* null : Not detailed
  4.   * isset: Detailed */
  5. "token": "xxxxxxx" //Valid token is required

Example Request:

  1. {
  2. "module":"schedule.shift",
  3. "method":"GET",
  4. "request":{
  5. "id":"15553",
  6. "detailed":"1"
  7. }
  8. }

Example Response:

  1. {
  2. "status":1,
  3. "data":{
  4. "id":"15553",
  5. "created":"1337333047",
  6. "published":"1339668653",
  7. "edited":"1337333048",
  8. "deleted":"0",
  9. "schedule":"32408",
  10. "type":"0",
  11. "needed":"0",
  12. "working":"1",
  13. "user":"2",
  14. "start_date":{
  15. "id":"1115",
  16. "month":"5",
  17. "day":"18",
  18. "year":"2012",
  19. "weekday":"Fri",
  20. "mname":"May",
  21. "week":"20",
  22. "dayid":6,
  23. "formatted":"May 18, 2012"
  24. },
  25. "end_date":{
  26. "id":"1115",
  27. "month":"5",
  28. "day":"18",
  29. "year":"2012",
  30. "weekday":"Fri",
  31. "mname":"May",
  32. "week":"20",
  33. "dayid":6,
  34. "formatted":"May 18, 2012"
  35. },
  36. "length":13,
  37. "title":"",
  38. "location":"0",
  39. "notes":"",
  40. "confirmed":"0",
  41. "perms":"2",
  42. "paidtime":13,
  43. "start_time":{
  44. "id":"33",
  45. "time":"8 am"
  46. },
  47. "end_time":{
  48. "id":"85",
  49. "time":"9 pm"
  50. },
  51. "schedule_name":"Admin\/meetings",
  52. "employees":[
  53. {
  54. "id":"3820",
  55. "name":"1338892003_Aly",
  56. "status":"-1",
  57. "wage":"10",
  58. "notified_day":"0",
  59. "notified_hour":"0",
  60. "last_active":"1338567617",
  61. "rate":"",
  62. "ratecard":"0",
  63. "cost":"130.00"
  64. }
  65. ],
  66. "cost":{
  67. "staff":1,
  68. "hours":13,
  69. "dollars":130
  70. },
  71. "repeats":"0"
  72. },
  73. "token":"xxxxxxx"
  74. }

---

CREATE
Creates an individual shift.
Level 3 is required.

--

Parameters:

  1. "start_time": required //Start time (time)
  2. "end_time": required //End time (time)
  3. "start_date": required //Start date (date)
  4. "end_date": required //End date (date)
  5. "schedule": accepted //Schedule id (integer)
  6. "type": accepted //Type (integer)
  7. /* 0: Shift without open slots
  8.   * 1: Shift with open slots (open shift) */
  9. "needed": accepted //Number of needed employees (integer)
  10. "notes": accepted //Notes (varchar)
  11. "title": accepted //Title (varchar)
  12. "confirmed": accepted //Confirmed (varchar)
  13. /* "0": Not confirmed
  14.   * "1": Confirmed */
  15. "location": accepted //Location id (integer)
  16. "token": "xxxxxxx" //Valid token is required

Example Request:

  1. {
  2. "module":"schedule.shift",
  3. "method":"CREATE",
  4. "request":{
  5. "start_time":"3:00am",
  6. "end_time":"11:00am",
  7. "start_date":"May 18, 2012",
  8. "end_date":"May 18, 2012"
  9. }
  10. }

Example Response:

  1. {
  2. "status":1,
  3. "data":{
  4. "id":"15553",
  5. "created":"1337333047",
  6. "published":"1339668653",
  7. "edited":"1337333048",
  8. "deleted":"0",
  9. "schedule":"32408",
  10. "type":"0",
  11. "needed":"0",
  12. "working":"1",
  13. "user":"2",
  14. "start_date":{
  15. "id":"1115",
  16. "month":"5",
  17. "day":"18",
  18. "year":"2012",
  19. "weekday":"Fri",
  20. "mname":"May",
  21. "week":"20",
  22. "dayid":6,
  23. "formatted":"May 18, 2012"
  24. },
  25. "end_date":{
  26. "id":"1115",
  27. "month":"5",
  28. "day":"18",
  29. "year":"2012",
  30. "weekday":"Fri",
  31. "mname":"May",
  32. "week":"20",
  33. "dayid":6,
  34. "formatted":"May 18, 2012"
  35. },
  36. "length":13,
  37. "title":"",
  38. "location":"0",
  39. "notes":"",
  40. "confirmed":"0",
  41. "perms":"2",
  42. "paidtime":13,
  43. "start_time":{
  44. "id":"33",
  45. "time":"3 am"
  46. },
  47. "end_time":{
  48. "id":"85",
  49. "time":"11 am"
  50. },
  51. "schedule_name":"Admin\/meetings",
  52. "employees":[
  53. {
  54. "id":"3820",
  55. "name":"1338892003_Aly",
  56. "status":"-1",
  57. "wage":"10",
  58. "notified_day":"0",
  59. "notified_hour":"0",
  60. "last_active":"1338567617",
  61. "rate":"",
  62. "ratecard":"0",
  63. "cost":"130.00"
  64. }
  65. ],
  66. "cost":{
  67. "staff":1,
  68. "hours":13,
  69. "dollars":130
  70. },
  71. "repeats":"0"
  72. },
  73. "token":"xxxxxxx"
  74. }

---

UPDATE
Updates an individual shift.
Level 3 is required.

--

Parameters:

  1. "id": required //Shifts id (integer)
  2. "schedule": accepted //Set of schedules ids (varchar)
  3. /* Array of schedule ids (eg. "234,563,770") */
  4. "type": accepted //Type (integer)
  5. /* 0: Shift without open slots
  6.   * 1: Shift with open slots (open shift) */
  7. "needed": accepted //Number of needed employees (integer)
  8. "start_time": accepted //Start time (time)
  9. "end_time": accepted //End time (time)
  10. "start_date": accepted //Start date (date)
  11. "end_date": accepted //End date (date)
  12. "notes": accepted //Notes (varchar)
  13. "title": accepted //Title (varchar)
  14. "confirmed": accepted //Confirmed (varchar)
  15. /* "0": Not confirmed
  16.   * "1": Confirmed */
  17. "add": accepted /*Add employee to a shift either by
  18.   user_id, or by full employee name (varchar) */
  19. "remove": accepted //Remove user by id (integer)
  20. "detailed": accepted //Detailed (varchar)
  21. /* isset: Detailed info */
  22. "location": accepted //Location id (varchar)
  23. "force": accepted //Force (enum[0,1])
  24. /* 0: Do not force force adding staff
  25.   * 1: Force adding staff */
  26. "repeat": accepted //Repeat (integer)
  27. /* 0: Do not repeat
  28.   * 1: Repeat daily
  29.   * 2: Repeat Monday-Friday
  30.   * 3: Repeat Monday-Thursday
  31.   * 4: Repeat Monday-Saturday
  32.   * 5: Repeat every other week
  33.   * 7: Repeat Weekly
  34.   * 9: Repeat weekend
  35.   * 10: Repeat Monday-Wednesday-Friday
  36.   * 11: Repeat Tuesday-Thursday
  37.   * 12: Repeat every second day
  38.   * 13: Repeat every month
  39.   * 14: Repeat every nine days
  40.   * 15: Repeat Tuesday-Saturday
  41.   * 16: Repeat every six weeks
  42.   * 17: Repeat every three weeks
  43.   * 18: Repeat every four weeks
  44.   * 90: Custom cycle - every n days/weeks
  45.   * 91: Custom cycle - n days on/n days off
  46.   * 92: Custom cycle - alt every n on/off
  47.   * 99: Custom cycle - alt every n on/off */
  48. "repeat_until": accepted //Repeat until date (date)
  49. "repeat_staff": accepted //Repeat staff (enum[1,2])
  50. /* 1: Shift time only
  51.   * 2: With Employees */
  52. "repeat_custom": //Custom repeat cycle (eg. SSSOOOO) S-Shift, O-Day off)
  53. "repeat_cycle": //Repeat cycle (enum[day,week])
  54. /* day : Repeat daily
  55.   * week: Repeat weekly */
  56. "repeat_cycle_on": //Repeat cycle on (integer)
  57. /* 0: Repeat cycle on
  58.   * 1: Repeat cycle off */
  59. "repeat_cycle_step": //Repeat cycle step (integer)
  60. /* Cycle step: Every n days/weeks. */
  61. "update_series": accepted //Update series (enum[1,2,3])
  62. /* 1: Make all future shifts the same as this one
  63.   * 2: Make all shifts in the series the same as this one
  64.   * 3: Revert this shift to original */
  65. "update_staff": accepted //Update staff (integer)
  66. /* 0: Do not update staff
  67.   * 1: Update staff */
  68. "update_time": accepted //Update time (enum[0,1])
  69. /* 0: Do not update time
  70.   * 1: Update time */
  71. "update_type": accepted //Update type (enum[0,1])
  72. /* 0: Do not update type
  73.   * 1: Update type */
  74. "update_notes": accepted //Update notes (enum[0,1])
  75. /* 0: Do not update notes
  76.   * 1: Update notes */
  77. "update_schedule": accepted //Update schedule (enum[0,1])
  78. /* 0: Do not update schedule
  79.   * 1: Update schedule */
  80. "copy_to": accepted //Copy to date (date)
  81. "restore": accepted //Restore (enum[0,1])
  82. /* 0: Do not restore
  83.   * 1: Restore */
  84. "token": "xxxxxxx" //Valid token is required

Example Request:

  1. {
  2. "module":"schedule.shift",
  3. "method":"UPDATE",
  4. "request":{
  5. "id":"632",
  6. "start_time":"3:00am",
  7. "end_time":"12:00am",
  8. "start_date":"May 18, 2012",
  9. "end_date":"May 18, 2012"
  10. }
  11. }

Example Response:

  1. {
  2. "status":1,
  3. "data":{
  4. "id":"15553",
  5. "created":"1337333047",
  6. "published":"1339668653",
  7. "edited":"1337333048",
  8. "deleted":"0",
  9. "schedule":"32408",
  10. "type":"0",
  11. "needed":"0",
  12. "working":"1",
  13. "user":"2",
  14. "start_date":{
  15. "id":"1115",
  16. "month":"5",
  17. "day":"18",
  18. "year":"2012",
  19. "weekday":"Fri",
  20. "mname":"May",
  21. "week":"20",
  22. "dayid":6,
  23. "formatted":"May 18, 2012"
  24. },
  25. "end_date":{
  26. "id":"1115",
  27. "month":"5",
  28. "day":"18",
  29. "year":"2012",
  30. "weekday":"Fri",
  31. "mname":"May",
  32. "week":"20",
  33. "dayid":6,
  34. "formatted":"May 18, 2012"
  35. },
  36. "length":13,
  37. "title":"",
  38. "location":"0",
  39. "notes":"",
  40. "confirmed":"0",
  41. "perms":"2",
  42. "paidtime":13,
  43. "start_time":{
  44. "id":"33",
  45. "time":"8 am"
  46. },
  47. "end_time":{
  48. "id":"85",
  49. "time":"12 am"
  50. },
  51. "schedule_name":"Admin\/meetings",
  52. "employees":[
  53. {
  54. "id":"3820",
  55. "name":"1338892003_Aly",
  56. "status":"-1",
  57. "wage":"10",
  58. "notified_day":"0",
  59. "notified_hour":"0",
  60. "last_active":"1338567617",
  61. "rate":"",
  62. "ratecard":"0",
  63. "cost":"130.00"
  64. }
  65. ],
  66. "cost":{
  67. "staff":1,
  68. "hours":13,
  69. "dollars":130
  70. },
  71. "repeats":"0"
  72. },
  73. "token":"xxxxxxx"
  74. }

---

DELETE
Deletes an individual shift.
Level 3 is required.

--

Parameters:

  1. "id": required //Shift id (integer)
  2. "rule": accepted //Rule (enum[0,1])
  3. /* 0: all
  4.   * 1: following */
  5. "token": "xxxxxxx" //Valid token is required

Example Request:

  1. {
  2. "module":"schedule.shift",
  3. "method":"DELETE",
  4. "request":{
  5. "id":"432"
  6. }
  7. }

Example Response:

  1. {
  2. "status":1,
  3. "data":"",
  4. "token":"xxxxxxx"
  5. }