Labor2.svc

Sending a Request to Labor2.svc
All calls to Labor2.svc require the AccessToken and the LocationToken in the HTTP Web Request Headers of the request. The parameters for the request body of each call are outlined in the sections below.

Labor2.svc Endpoint
Endpoint
https://{{server}}.brinkpos.net/Labor2.svc


HTTP Web Request Headers
Header Name
Header Value
AccessToken
{{AccessToken}}
LocationToken
{{LocationToken}}
This call is to retrieve a LaborSchedule object for the location.

GetLaborSchedule Request
Data Name
Data Type
Data Description
EndDate
DateTime
Specify the end date of the range you would like to see the Labor Schedule to
StartDate
DateTime
Specify the start date of the range you would like to see the Labor Schedule from


GetLaborSchedule Response
Data Name
Data Type
Data Description
LaborSchedule
Labor schedule for this business date
Message
string
Returns a Brink Error message if the request did not go through. Otherwise, this field will be null.
ResultCode
int
Returns one of the following:
  • 0 = Request went through successfully
  • 1 = Request returned an unknown error
  • 2 = Request was not valid
  • 3 = Server is currently unavailable and unable to receive the request
  • 4 = Access Denied
This call is to retrieve an array of Shift objects for the location.

GetShifts Request
Data Name
Data Type
Data Description
BusinessDate
DateTime?
Specify the business date for which you would like to see the shifts worked
ModifiedTime
DateTimeOffset?
(Optional) When specified, only shifts that have been modified on or after the specified time will be retrieved. This compares against any edited shifts on the Register time.


GetShifts Response
Data Name
Data Type
Data Description
Message
string
Returns a Brink Error message if the request did not go through. Otherwise, this field will be null.
ResultCode
int
Returns one of the following:
  • 0 = Request went through successfully
  • 1 = Request returned an unknown error
  • 2 = Request was not valid
  • 3 = Server is currently unavailable and unable to receive the request
  • 4 = Access Denied
Shifts
Array of Shift
Shifts worked on this business date
This call is to save a labor schedule of scheduled shifts for the location for one or more days.

SaveLaborSchedule Request
Data Name
Data Type
Data Description
LaborSchedule
Specify the labor schedule you would like to save for this location


SaveLaborSchedule Response
Data Name
Data Type
Data Description
EmployeeId
int?
Populated with an Employee Id if the request is invalid, e.g. if the employee has been terminated or in the case of an invalid JobId listed for an employee. Otherwise, this field will be null.
JobId
int?
Populated with a Job Id if the request is invalid, e.g. in the case of there is an invalid JobId listed for an employee. Otherwise, this field will be null.
Message
string
Returns a Brink Error message if the request did not go through. Otherwise, this field will be null.
ResultCode
int
Returns one of the following:
  • 0 = Request went through successfully
  • 1 = Request returned an unknown error
  • 2 = Request was not valid
  • 3 = Server is currently unavailable and unable to receive the request
  • 4 = Access Denied
ValidationMessages
Array of string
Details if the request was unsuccessful
Global Type
All the Types available in Labor2.svc will be displayed below.

Break Type
Data Name
Data Type
Data Description
EndTime
DateTimeOffset
End time of this Break
Minutes
int
Minutes of this paid Break (unpaid Breaks not included)
Number
byte
Incremental count of the employee's Breaks for a particular business date. (e.g. Returns a "1" for first break of the day, "2" for second, etc.)
IsPaid
bool
True if this is paid Break, False if not
StartTime
DateTimeOffset
Start time of this Break



LaborSchedule Type
Data Name
Data Type
Data Description
Days
Array of LaborScheduleDay
Labor schedule for a date range



LaborScheduleDay Type
Data Name
Data Type
Data Description
BusinessDate
DateTime
Business date for this LaborScheduleDay (the time component will always return as 00:00:00)
Shifts
Array of ScheduledShift
Scheduled shifts for this LaborScheduleDay



ScheduledShift Type
Data Name
Data Type
Data Description
EmployeeId
int
Maps to the Id of the Employee for this ScheduledShift
EndTime
TimeSpan
End time of this ScheduledShift
JobId
int
Maps to the Id of the Job for this ScheduledShift
StartTime
TimeSpan
Start time of this ScheduledShift



Shift Type
Data Name
Data Type
Data Description
Breaks
Array of Break
Breaks for this Shift
BusinessDate
DateTime
Business date of this Shift (the time component will always return as 00:00:00)
ClockOutBusinessDate
DateTime
Business date on which this Shift was clocked out (the time component will always return as 00:00:00)
DeclaredTips
decimal
Tips declared for this Shift
EmployeeId
int
Maps to the Id of the Employee for this Shift
EndTime
DateTimeOffset
End time of this Shift
ExtendedMinutesWorked
int
Amount of minutes worked for this Shift outside of regular working hours, to be paid at a regular pay rate
Id
Guid
Unique Id of this Shift
JobId
int
Maps to the Id of the Job for this Shift
MinutesWorked
int
Amount of total minutes worked for this Shift
ModifiedTime
DateTimeOffset
Date and time of the last time this Shift was modified (e.g. by a clock in/out or break event)
Number
byte
Incremental count of the employee's Shifts for a particular business date. (e.g. Returns a "1" for first shift of the day, "2" for second, etc.)
OvertimeMinutesWorked
int
Amount of minutes worked for this Shift in overtime, to be paid at an overtime pay rate
PayRate
decimal
Payrate that was current for the job at the time of this Shift
RegularMinutesWorked
int
Amount of minutes worked for this Shift within regular working hours, to be paid at a regular pay rate
StartTime
DateTimeOffset
Start time of this Shift



                    
                        
                        
                        
                        
GetLaborSchedule Sample Code
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.ServiceModel; using System.ServiceModel.Web; using Labor2_GetLaborSchedule.Labor2ServiceReference; namespace Labor2_GetLaborSchedule { class Program { static void Main(string[] args) { //Connect to Labor2 service client var client = new LaborWebService2Client(); //Set security protocol to TLS 1.2 System.Net.ServicePointManager.SecurityProtocol = System.Net.SecurityProtocolType.Tls12; using (var scope = new OperationContextScope(client.InnerChannel)) { //Include tokens in HTTP Web Request Headers var headers = WebOperationContext.Current.OutgoingRequest.Headers; headers["AccessToken"] = @"AccessToken"; headers["LocationToken"] = @"LocationToken"; DateTime startDate = new DateTime(2001, 01, 01); DateTime endDate = new DateTime(2001, 01, 08); //Include StartDate and EndDate parameters in request body var request = new GetLaborScheduleRequest() { StartDate = startDate, EndDate = endDate, }; //Make GetLaborSchedule call var response = client.GetLaborSchedule(request); //If call is successful if (response.ResultCode == 0) { if (response.LaborSchedule.Days.Length > 0) { //Loop through collection of LaborScheduleDay objects returned foreach (var day in response.LaborSchedule.Days) { Console.WriteLine("BusinessDate: " + day.BusinessDate); if (day.Shifts.Length > 0) { //Loop through collection of ScheduledShift objects returned for each BusinessDate foreach (var shift in day.Shifts) { Console.WriteLine("Shifts:"); Console.WriteLine("\tEmployeeId: " + shift.EmployeeId); Console.WriteLine("\tJobId: " + shift.JobId); Console.WriteLine("\tStartTime: " + shift.StartTime); Console.WriteLine("\tEndTime: " + shift.EndTime); Console.WriteLine("\t------------"); } } else { Console.WriteLine("\tNo Shifts"); } Console.WriteLine("---------------------------"); } } else { Console.WriteLine("No Labor Schedule"); Console.WriteLine("---------------------------"); } Console.WriteLine("End"); Console.ReadKey(); } else { Console.WriteLine("Error Code: " + response.ResultCode); Console.WriteLine("Message: " + response.Message); Console.ReadKey(); } } } } }
GetLaborSchedule Sample Code
using Microsoft.Extensions.DependencyInjection; using ServiceReference6; using System.ServiceModel; using System.ServiceModel.Channels; namespace Labor2_GetLaborSchedule { class Program { public static ServiceCollection services = new ServiceCollection(); public static void AddLaborServiceClient() { services.AddTransient<ILaborWebService2>((provider) => { BasicHttpBinding binding = new BasicHttpBinding(); binding.MaxReceivedMessageSize = 2147483647; EndpointAddress endpointAddress = new EndpointAddress("{YOUR_WSDL_URL_GOES_HERE}"); ChannelFactory<ILaborWebService2> factory = new ChannelFactory<ILaborWebService2>(binding, endpointAddress); return factory.CreateChannel(); }); } static void Main(string[] args) { AddLaborServiceClient(); ILaborWebService2 client = services.BuildServiceProvider().GetRequiredService<ILaborWebService2>(); try { int count = 1; using (OperationContextScope scope = new OperationContextScope((IContextChannel)client)) { OperationContext context = OperationContext.Current; HttpRequestMessageProperty httpRequestProperty = new HttpRequestMessageProperty(); httpRequestProperty.Headers["AccessToken"] = 'AccessToken'; httpRequestProperty.Headers["LocationToken"] = 'LocationToken'; context.OutgoingMessageProperties[HttpRequestMessageProperty.Name] = httpRequestProperty; DateTime startDate = new DateTime(2001, 01, 01); DateTime endDate = new DateTime(2001, 01, 08); //Include StartDate and EndDate parameters in request body var request = new GetLaborScheduleRequest() { StartDate = startDate, EndDate = endDate, }; //Make GetLaborSchedule call var response = client.GetLaborScheduleAsync(request); Console.WriteLine("GetLaborSchedule"); Console.WriteLine("-----------------"); //If call is successful if (response.Result.ResultCode == 0) { Console.WriteLine(response.Result.ResultCode); if (response.Result.LaborSchedule.Days.Length > 0) { //Loop through collection of LaborScheduleDay objects returned foreach (var day in response.Result.LaborSchedule.Days) { Console.WriteLine("BusinessDate: " + day.BusinessDate); if (day.Shifts.Length > 0) { //Loop through collection of ScheduledShift objects returned for each BusinessDate foreach (var shift in day.Shifts) { Console.WriteLine("Shifts:"); Console.WriteLine("\tEmployeeId: " + shift.EmployeeId); Console.WriteLine("\tJobId: " + shift.JobId); Console.WriteLine("\tStartTime: " + shift.StartTime); Console.WriteLine("\tEndTime: " + shift.EndTime); Console.WriteLine("\t------------"); } } else { Console.WriteLine("\tNo Shifts"); } Console.WriteLine("---------------------------"); } } else { Console.WriteLine("No Labor Schedule"); Console.WriteLine("---------------------------"); } Console.ReadKey(); } else { Console.WriteLine("Error Code: " + response.Result.ResultCode); Console.WriteLine("Message: " + response.Result.Message); } } } catch (Exception ex) { Console.WriteLine("Error calling GetLaborSchedule operation: " + ex.Message); } } } }
GetLaborSchedule Sample Code
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:v2="http://www.brinksoftware.com/webservices/labor/v2"> <soapenv:Header/> <soapenv:Body> <v2:GetLaborSchedule> <v2:request> <v2:EndDate>2001-01-08</v2:EndDate> <v2:StartDate>2001-01-01</v2:StartDate> </v2:request> </v2:GetLaborSchedule> </soapenv:Body> </soapenv:Envelope>
GetLaborSchedule Sample Code
from zeep import Client from zeep.transports import Transport import requests from datetime import datetime accessToken = 'AccessToken' locationToken = 'LocationToken' #Include tokens in HTTP Web Request Headers session = requests.Session() session.headers.update({'AccessToken': accessToken, 'LocationToken': locationToken}) transport = Transport(session=session) #Connect to Labor2 service client client = Client(wsdl='{YOUR_WSDL_URL_GOES_HERE}', transport=transport) service = client.create_service( '{http://www.brinksoftware.com/webservices/labor/v2}BasicHttpBinding_ILaborWebService2', 'https://{YourStack}.brinkpos.net/Labor2.svc' ) #Prepare the dynamic type for GetLaborScheduleRequest reqType = client.get_type('ns1:GetLaborScheduleRequest') startDate = datetime(2001, 1, 1) endDate = datetime(2001, 1, 8) #Include StartDate and EndDate parameters in request body req = reqType( StartDate=startDate, EndDate=endDate, ) try: #Make GetLaborSchedule call res = service.GetLaborSchedule(req) #If call is successful if res.ResultCode == 0: if res.LaborSchedule.Days != None: #Loop through collection of LaborScheduleDay objects returned for day in res.LaborSchedule.Days.LaborScheduleDay: print('BusinessDate: ' + str(day.BusinessDate)) if day.Shifts != None: print('Shifts:') #Loop through collection of ScheduledShift objects returned for each BusinessDate for shift in day.Shifts.ScheduledShift: print('\tEmployeeId: ' + str(shift.EmployeeId)) print('\tJobId: ' + str(shift.JobId)) print('\tStartTime: ' + str(shift.StartTime)) print('\tEndTime: ' + str(shift.EndTime)) print('\t------------') else: print('No Shifts') print('---------------------------') else: print('No Labor Schedule') print('---------------------------') print('End') else: print('Error Code: ' + str(res.ResultCode)) print('Message: ' + str(res.Message)) except Exception as e: print(e)

                    
                        
                        
                        
                        
GetShifts Sample Code
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.ServiceModel; using System.ServiceModel.Web; using Labor2_GetShifts.Labor2ServiceReference; namespace Labor2_GetShifts { class Program { static void Main(string[] args) { //Connect to Labor2 service client var client = new LaborWebService2Client(); //Set security protocol to TLS 1.2 System.Net.ServicePointManager.SecurityProtocol = System.Net.SecurityProtocolType.Tls12; using (var scope = new OperationContextScope(client.InnerChannel)) { //Include tokens in HTTP Web Request Headers var headers = WebOperationContext.Current.OutgoingRequest.Headers; headers["AccessToken"] = @"AccessToken"; headers["LocationToken"] = @"LocationToken"; DateTime businessDate = new DateTime(2001, 01, 01); //Include BusinessDate parameter in UTC in request body var request = new GetShiftsRequest() { BusinessDate = businessDate, }; //Make GetShifts call var response = client.GetShifts(request); //If call is successful if (response.ResultCode == 0) { if (response.Shifts.Length > 0) { //Loop through collection of Shift objects returned foreach (var shift in response.Shifts) { Console.WriteLine("BusinessDate: " + shift.BusinessDate); Console.WriteLine("ClockOutBusinessDate: " + shift.ClockOutBusinessDate); Console.WriteLine("EmployeeId: " + shift.EmployeeId); Console.WriteLine("JobId: " + shift.JobId); Console.WriteLine("Id: " + shift.Id); Console.WriteLine("StartTime: " + shift.StartTime); Console.WriteLine("EndTime: " + shift.EndTime); Console.WriteLine("ModifiedTime: " + shift.ModifiedTime); Console.WriteLine("Number: " + shift.Number); Console.WriteLine("PayRate: " + shift.PayRate); Console.WriteLine("DeclaredTips: " + shift.DeclaredTips); Console.WriteLine("MinutesWorked: " + shift.MinutesWorked); Console.WriteLine("RegularMinutesWorked: " + shift.RegularMinutesWorked); Console.WriteLine("ExtendedMinutesWorked: " + shift.ExtendedMinutesWorked); Console.WriteLine("OvertimeMinutesWorked: " + shift.OvertimeMinutesWorked); if (shift.Breaks.Length > 0) { //Loop through collection of Break objects returned for each Shift foreach (var workBreak in shift.Breaks) { Console.WriteLine("Breaks: "); Console.WriteLine("\tStartTime: " + workBreak.StartTime); Console.WriteLine("\tEndTime: " + workBreak.EndTime); Console.WriteLine("\tNumber: " + workBreak.Number); Console.WriteLine("\tMinutes: " + workBreak.Minutes); Console.WriteLine("\tIsPaid: " + workBreak.IsPaid); Console.WriteLine("\t------------"); } } else { Console.WriteLine("\tNo Breaks"); } Console.WriteLine("---------------------------"); } } else { Console.WriteLine("No Shifts"); Console.WriteLine("---------------------------"); } Console.WriteLine("End"); Console.ReadKey(); } else { Console.WriteLine("Error Code: " + response.ResultCode); Console.WriteLine("Message: " + response.Message); Console.ReadKey(); } } } } }
GetShifts Sample Code
using Microsoft.Extensions.DependencyInjection; using ServiceReference6; using System.ServiceModel; using System.ServiceModel.Channels; namespace Labor2_GetShifts { class Program { public static ServiceCollection services = new ServiceCollection(); public static void AddLaborServiceClient() { services.AddTransient<ILaborWebService2>((provider) => { BasicHttpBinding binding = new BasicHttpBinding(); binding.MaxReceivedMessageSize = 2147483647; EndpointAddress endpointAddress = new EndpointAddress("{YOUR_WSDL_URL_GOES_HERE}"); ChannelFactory<ILaborWebService2> factory = new ChannelFactory<ILaborWebService2>(binding, endpointAddress); return factory.CreateChannel(); }); } static void Main(string[] args) { AddLaborServiceClient(); ILaborWebService2 client = services.BuildServiceProvider().GetRequiredService<ILaborWebService2>(); try { int count = 1; using (OperationContextScope scope = new OperationContextScope((IContextChannel)client)) { OperationContext context = OperationContext.Current; HttpRequestMessageProperty httpRequestProperty = new HttpRequestMessageProperty(); httpRequestProperty.Headers["AccessToken"] = 'AccessToken'; httpRequestProperty.Headers["LocationToken"] = 'LocationToken'; context.OutgoingMessageProperties[HttpRequestMessageProperty.Name] = httpRequestProperty; DateTime businessDate = new DateTime(2024, 04, 08); //Include BusinessDate parameter in UTC in request body var request = new GetShiftsRequest() { BusinessDate = businessDate, ModifiedTime = businessDate }; //Make GetShifts call var response = client.GetShiftsAsync(request); Console.WriteLine("GetShifts"); Console.WriteLine("----------"); //If call is successful if (response.Result.ResultCode == 0) { Console.WriteLine(response.Result.ResultCode); if (response.Result.Shifts.Length > 0) { //Loop through collection of Shift objects returned foreach (var shift in response.Result.Shifts) { Console.WriteLine("BusinessDate: " + shift.BusinessDate); Console.WriteLine("ClockOutBusinessDate: " + shift.ClockOutBusinessDate); Console.WriteLine("EmployeeId: " + shift.EmployeeId); Console.WriteLine("JobId: " + shift.JobId); Console.WriteLine("Id: " + shift.Id); Console.WriteLine("StartTime: " + shift.StartTime); Console.WriteLine("EndTime: " + shift.EndTime); Console.WriteLine("ModifiedTime: " + shift.ModifiedTime); Console.WriteLine("Number: " + shift.Number); Console.WriteLine("PayRate: " + shift.PayRate); Console.WriteLine("DeclaredTips: " + shift.DeclaredTips); Console.WriteLine("MinutesWorked: " + shift.MinutesWorked); Console.WriteLine("RegularMinutesWorked: " + shift.RegularMinutesWorked); Console.WriteLine("ExtendedMinutesWorked: " + shift.ExtendedMinutesWorked); Console.WriteLine("OvertimeMinutesWorked: " + shift.OvertimeMinutesWorked); if (shift.Breaks.Length > 0) { //Loop through collection of Break objects returned for each Shift foreach (var workBreak in shift.Breaks) { Console.WriteLine("Breaks: "); Console.WriteLine("\tStartTime: " + workBreak.StartTime); Console.WriteLine("\tEndTime: " + workBreak.EndTime); Console.WriteLine("\tNumber: " + workBreak.Number); Console.WriteLine("\tMinutes: " + workBreak.Minutes); Console.WriteLine("\tIsPaid: " + workBreak.IsPaid); Console.WriteLine("\t------------"); } } else { Console.WriteLine("\tNo Breaks"); } Console.WriteLine("---------------------------"); } } else { Console.WriteLine("No Shifts"); Console.WriteLine("---------------------------"); } Console.ReadKey(); } else { Console.WriteLine("Error Code: " + response.Result.ResultCode); Console.WriteLine("Message: " + response.Result.Message); } } } catch (Exception ex) { Console.WriteLine("Error calling GetShifts operation: " + ex.Message); } } } }
GetShifts Sample Code
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:v2="http://www.brinksoftware.com/webservices/labor/v2" xmlns:sys="http://schemas.datacontract.org/2004/07/System"> <soapenv:Header/> <soapenv:Body> <v2:GetShifts> <v2:request> <v2:BusinessDate>2001-01-01</v2:BusinessDate> <!--<v2:ModifiedTime> <sys:DateTime>?</sys:DateTime> <sys:OffsetMinutes>?</sys:OffsetMinutes> </v2:ModifiedTime>--> </v2:request> </v2:GetShifts> </soapenv:Body> </soapenv:Envelope>
GetShifts Sample Code
from zeep import Client from zeep.transports import Transport import requests from datetime import datetime accessToken = 'AccessToken' locationToken = 'LocationToken' #Include tokens in HTTP Web Request Headers session = requests.Session() session.headers.update({'AccessToken': accessToken, 'LocationToken': locationToken}) transport = Transport(session=session) #Connect to Labor2 service client client = Client(wsdl='{YOUR_WSDL_URL_GOES_HERE}', transport=transport) service = client.create_service( '{http://www.brinksoftware.com/webservices/labor/v2}BasicHttpBinding_ILaborWebService2', 'https://{YourStack}.brinkpos.net/Labor2.svc' ) #Prepare the dynamic type for GetShiftsRequest reqType = client.get_type('ns1:GetShiftsRequest') businessDate = datetime(2001, 1, 1) #Include BusinessDate parameter in request body req = reqType(BusinessDate=businessDate) try: #Make GetShifts call res = service.GetShifts(req) #If call is successful if res.ResultCode == 0: if res.Shifts != None: #Loop through collection of Shift objects returned for shift in res.Shifts.Shift: print('BusinessDate: ' + str(shift.BusinessDate)) print('ClockOutBusinessDate: ' + str(shift.ClockOutBusinessDate)) print('EmployeeId: ' + str(shift.EmployeeId)) print('JobId: ' + str(shift.JobId)) print('Id: ' + str(shift.Id)) print('StartTime: ' + str(shift.StartTime)) print('EndTime: ' + str(shift.EndTime)) print('ModifiedTime: ' + str(shift.ModifiedTime)) print('Number: ' + str(shift.Number)) print('PayRate: ' + str(shift.PayRate)) print('MinutesWorked: ' + str(shift.MinutesWorked)) print('RegularMinutesWorked: ' + str(shift.RegularMinutesWorked)) print('ExtendedMinutesWorked: ' + str(shift.ExtendedMinutesWorked)) print('OvertimeMinutesWorked: ' + str(shift.OvertimeMinutesWorked)) if shift.Breaks != None: print('Breaks:') #Loop through collection of Break objects returned for each Shift for workBreak in shift.Breaks.Break: print('\tStartTime: ' + str(workBreak.StartTime)) print('\tEndTime: ' + str(workBreak.EndTime)) print('\tNumber: ' + str(workBreak.Number)) print('\tMinutes: ' + str(workBreak.Minutes)) print('\tIsPaid: ' + str(workBreak.IsPaid)) print('\t------------') else: print('No Breaks') print('---------------------------') else: print('No Shifts') print('---------------------------') print('End') else: print('Error Code: ' + str(res.ResultCode)) print('Message: ' + str(res.Message)) except Exception as e: print(e)

                    
                        
                        
                        
                        
SaveLaborSchedule Sample Code
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.ServiceModel; using System.ServiceModel.Web; using Labor2_SaveLaborSchedule.Labor2ServiceReference; namespace Labor2_SaveLaborSchedule { class Program { public static LaborSchedule CreateLaborSchedule() { //Create ScheduledShift objects ScheduledShift shift = new ScheduledShift() { EmployeeId = 123, StartTime = new TimeSpan(8, 0, 0), EndTime = new TimeSpan(16, 0, 0), JobId = 456, }; List<ScheduledShift> scheduledShifts = new List<ScheduledShift>(); scheduledShifts.Add(shift); //Include BusinessDate and array of ScheduledShift objects in LaborScheduleDay object LaborScheduleDay laborScheduleDay = new LaborScheduleDay() { BusinessDate = new DateTime(2001, 01, 01), Shifts = scheduledShifts.ToArray(), }; List<LaborScheduleDay> laborScheduleDays = new List<LaborScheduleDay>(); laborScheduleDays.Add(laborScheduleDay); //Include array of LaborScheduleDay objects in LaborSchedule object LaborSchedule laborSchedule = new LaborSchedule() { Days = laborScheduleDays.ToArray(), }; return laborSchedule; } static void Main(string[] args) { //Connect to Labor2 service client var client = new LaborWebService2Client(); //Set security protocol to TLS 1.2 System.Net.ServicePointManager.SecurityProtocol = System.Net.SecurityProtocolType.Tls12; using (var scope = new OperationContextScope(client.InnerChannel)) { //Include tokens in HTTP Web Request Headers var headers = WebOperationContext.Current.OutgoingRequest.Headers; headers["AccessToken"] = @"AccessToken"; headers["LocationToken"] = @"LocationToken"; //Include LaborSchedule parameter in request body var request = new SaveLaborScheduleRequest() { LaborSchedule = CreateLaborSchedule(), }; //Make SaveLaborSchedule call var response = client.SaveLaborSchedule(request); //If call is successful if (response.ResultCode == 0) { Console.WriteLine("Success!"); Console.ReadKey(); } else { Console.WriteLine("Error Code: " + response.ResultCode); Console.WriteLine("Message: " + response.Message); if (response.EmployeeId != null) { Console.WriteLine("EmployeeId: " + response.EmployeeId); } if (response.JobId != null) { Console.WriteLine("JobId: " + response.JobId); } Console.ReadKey(); } } } } }
SaveLaborSchedule Sample Code
using Microsoft.Extensions.DependencyInjection; using ServiceReference6; using System.ServiceModel; using System.ServiceModel.Channels; namespace Labor2_SaveLaborSchedule { class Program { public static ServiceCollection services = new ServiceCollection(); public static void AddLaborServiceClient() { services.AddTransient<ILaborWebService2>((provider) => { BasicHttpBinding binding = new BasicHttpBinding(); binding.MaxReceivedMessageSize = 2147483647; EndpointAddress endpointAddress = new EndpointAddress("{YOUR_WSDL_URL_GOES_HERE}"); ChannelFactory<ILaborWebService2> factory = new ChannelFactory<ILaborWebService2>(binding, endpointAddress); return factory.CreateChannel(); }); } public static LaborSchedule CreateLaborSchedule() { //Create ScheduledShift objects ScheduledShift shift = new ScheduledShift() { EmployeeId = 4003634, StartTime = new TimeSpan(8, 0, 0), EndTime = new TimeSpan(16, 0, 0), JobId = 1, }; List<ScheduledShift> scheduledShifts = new List<ScheduledShift>(); scheduledShifts.Add(shift); //Include BusinessDate and array of ScheduledShift objects in LaborScheduleDay object LaborScheduleDay laborScheduleDay = new LaborScheduleDay() { BusinessDate = new DateTime(2024, 04, 08), Shifts = scheduledShifts.ToArray(), }; List<LaborScheduleDay> laborScheduleDays = new List<LaborScheduleDay>(); laborScheduleDays.Add(laborScheduleDay); //Include array of LaborScheduleDay objects in LaborSchedule object LaborSchedule laborSchedule = new LaborSchedule() { Days = laborScheduleDays.ToArray(), }; return laborSchedule; } static void Main(string[] args) { AddLaborServiceClient(); ILaborWebService2 client = services.BuildServiceProvider().GetRequiredService<ILaborWebService2>(); try { int count = 1; using (OperationContextScope scope = new OperationContextScope((IContextChannel)client)) { OperationContext context = OperationContext.Current; HttpRequestMessageProperty httpRequestProperty = new HttpRequestMessageProperty(); httpRequestProperty.Headers["AccessToken"] = 'AccessToken'; httpRequestProperty.Headers["LocationToken"] = 'LocationToken'; context.OutgoingMessageProperties[HttpRequestMessageProperty.Name] = httpRequestProperty; var request = new SaveLaborScheduleRequest() { LaborSchedule = CreateLaborSchedule(), }; //Make SaveLaborSchedule call var response = client.SaveLaborScheduleAsync(request); Console.WriteLine("SaveLaborSchedule"); Console.WriteLine("-------------------"); //If call is successful if (response.Result.ResultCode == 0) { Console.WriteLine("Success!"); Console.ReadKey(); } else { Console.WriteLine("Error Code: " + response.Result.ResultCode); Console.WriteLine("Message: " + response.Result.Message); if (response.Result.EmployeeId != null) { Console.WriteLine("EmployeeId: " + response.Result.EmployeeId); } if (response.Result.JobId != null) { Console.WriteLine("JobId: " + response.Result.JobId); } Console.ReadKey(); } } } catch (Exception ex) { Console.WriteLine("Error calling SaveLaborSchedule operation: " + ex.Message); } } } }
SaveLaborSchedule Sample Code
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:v2="http://www.brinksoftware.com/webservices/labor/v2"> <soapenv:Header/> <soapenv:Body> <v2:SaveLaborSchedule> <v2:request> <v2:LaborSchedule> <v2:Days> <!--Zero or more repetitions:--> <v2:LaborScheduleDay> <v2:BusinessDate>2001-01-01</v2:BusinessDate> <v2:Shifts> <v2:ScheduledShift> <v2:EmployeeId>123</v2:EmployeeId> <v2:EndTime>PT08H</v2:EndTime> <v2:JobId>456</v2:JobId> <v2:StartTime>PT16H</v2:StartTime> </v2:ScheduledShift> </v2:Shifts> </v2:LaborScheduleDay> </v2:Days> </v2:LaborSchedule> </v2:request> </v2:SaveLaborSchedule> </soapenv:Body> </soapenv:Envelope>
SaveLaborSchedule Sample Code
from zeep import Client from zeep.transports import Transport import requests from datetime import datetime, timedelta #Helper function to create ScheduledShift def CreateScheduledShifts(factory): scheduledShifts = [] startTime = timedelta(hours=8) endTime = timedelta(hours=16) scheduledShift = factory.ScheduledShift( EmployeeId=123, JobId=456, StartTime=startTime, EndTime=endTime, ) scheduledShifts.append(scheduledShift) scheduledShiftsArray = factory.ArrayOfScheduledShift(ScheduledShift=scheduledShifts) return scheduledShiftsArray #Helper function to create LaborSchedule with LaborScheduleDay, BusinessDate and ScheduledShift included def CreateLaborSchedule(factory): labourScheduleDays = [] laborScheduleDay = factory.LaborScheduleDay( BusinessDate=datetime(2001, 1, 1), Shifts=CreateScheduledShifts(factory) ) labourScheduleDays.append(laborScheduleDay) laborScheduleDays = factory.ArrayOfLaborScheduleDay(LaborScheduleDay=labourScheduleDays) laborSchedule = factory.LaborSchedule(Days=laborScheduleDays) return laborSchedule accessToken = 'AccessToken' locationToken = 'LocationToken' #Include tokens in HTTP Web Request Headers session = requests.Session() session.headers.update({'AccessToken': accessToken, 'LocationToken': locationToken}) transport = Transport(session=session) #Connect to Settings2 service client client = Client(wsdl='{YOUR_WSDL_URL_GOES_HERE}', transport=transport) service = client.create_service( '{http://www.brinksoftware.com/webservices/labor/v2}BasicHttpBinding_ILaborWebService2', 'https://{YourStack}.brinkpos.net/labor2.svc' ) #Include LaborSchedule parameter in request body factory = client.type_factory('ns1') req = factory.SaveLaborScheduleRequest(LaborSchedule=CreateLaborSchedule(factory)) try: #Make SaveLaborSchedule call res = service.SaveLaborSchedule(req) #If call is successful if(res.ResultCode == 0): print('Success!') else: print('Error Code: ' + str(res.ResultCode)) print('Message: ' + str(res.Message)) if(res.EmployeeId != None): print('EmployeeId: ' + str(res.EmployeeId)) if(res.JobId != None): print('JobId: ' + str(res.JobId)) except Exception as e: print(e)