The shift exchange services can be used to make exchanges between two shifts, as opposed to the bid services, where there is only one shift involved.
a) Create New Shift Exchange
This creates a new shift exchange. This is available for employees only. Planners cannot exchange shifts.
Request (JSON)
POST /exchanges/?securitytoken={sessionToken} {"ProposerShiftId":"<shiftId1>","AccepterShiftId":"<shiftId2>"}
Response (JSON)
HTTP/1.1 200 OK
b) List of Shifts to Exchange With
This service returns a list of shifts that the current shift can be exchanged with. This is available for employees only.
Request (JSON)
GET /Exchanges/Available/?shiftId={shiftIdToExchange}&securityToken={token}
Response (JSON)
[{"EmployeeId":"AA1A148A-3138-4BE5-9892-4A6F6EE9F95B", "Name":"Peter", "HaveShifts":"false", "BreakCode":"Q", "EndDateTime":"\/Date(1316700000000+0200)\/", "StartDateTime":"\/Date(1316671200000+0200)\/"}, "Comment":"Lukke", "CanExchangeShift":"false"}, ... {"EmployeeId":"AA1A148A-3138-4BE5-9892-4A6F6EE9F95B", "Name":"Peter", "HaveShifts":"false", "BreakCode":"Q", "EndDateTime":"\/Date(1316700000000+0200)\/", "StartDateTime":"\/Date(1316671200000+0200)\/"}, "Comment":"Lukke", "CanExchangeShift":"true"}]
c) Get List of Pending Approvals (Employee and Planner)
You can get a list of pending shift exchange approvals.
An employee will get a list of shift exchanges that they need to approve or deny – this means that the employee approves or denies that they would like to exchange the selected shifts with another employee.
A planner will get a list of shift exchanges that have been approved by the employee, and they need to approve the shift exchange to finalize it.
The Violate11HourRule
property is only available when the planner has approved the request. If the property is True
, there will be an alert.
Request (JSON)
GET /Exchanges/Requests/?securityToken={sessionToken}
Response (XML)
<ArrayOfShiftExchangeRequest xmlns="http://schemas.datacontract.org/2004/07/Tamigo.Services.Entities" xmlns:i="http://www.w3.org/2001/XMLSchema-instance"> <ShiftExchangeRequest> <Comment i:nil="true"/> <EmployeeId1>38f02810-6ac4-40b4-b238-39236c826118</EmployeeId1> <EmployeeId2>3203ba4b-5264-4f36-8daa-76e7e69d0f31</EmployeeId2> <EmployeeName1>Peter</EmployeeName1> <EmployeeName2>Karina</EmployeeName2> <EndDateTime1>2011-12-24T16:00:00</EndDateTime1> <EndDateTime2>2011-12-23T16:00:00</EndDateTime2> <IsAccepted i:nil="true"/> <RequestId>9aeb6e1a-d50a-40f0-bd79-0369fcc25ddc</RequestId> <ShiftHours1>7.25</ShiftHours1> <ShiftHours2>7.25</ShiftHours2> <StartDateTime1>2011-12-24T08:00:00</StartDateTime1> <StartDateTime2>2011-12-23T08:00:00</StartDateTime2> <Violate11HourRule>False</Violate11HourRule> <ShiftComment1>Åbner</ ShiftComment1> < ShiftComment2>Lukker</ ShiftComment2> < ShiftBreakCode1>P</ ShiftBreakCode1> < ShiftBreakCode2>Q</ ShiftBreakCode2> </ShiftExchangeRequest> </ArrayOfShiftExchangeRequest>
d) Approve or Deny a Shift Exchange
Approve or deny a shift exchange.
The approval is a two-step process:
- Approval by the employee who is receiving the shift exchange request
- Approval by the planner
This is available for all roles.
Request (JSON)
PUT /Exchanges/Requests/{requestId}/ {isAccepted}/?securitytoken={sessionToken}
Response (JSON)
HTTP/1.1 200 OK
e) Withdraw a Shift Exchange
Use this service to withdraw a shift exchange if the other employee has not approved it yet.
Request (JSON)
PUT /Exchanges/withdraw/{shiftId}/?securitytoken={sessionToken}
Response (JSON)
HTTP/1.1 200 OK {"Message":null,"Success":true}