InPay provides a REST Web Service Interface that allows two-way flow of information to external systems. This enables automated and efficient transfer of data to and from your other systems reducing effort and duplication.
If you wish to know the commercials or costs involved in using Web Services then please contact the Client Account Management team. If you would like to enable the use of Web Services please contact our Support team and an estimate will be raised. It will need to be enabled on your system and a set of credentials for accessing the service will be supplied.
The full technical https://inpay.es.rsmuk.com/WebServicesREST/Help
Scenarios and uses
This section describes various scenarios of how the Web Services can be used.
Authentication
Before you can call any other InPay Web Service method you must first call the authenticate() method. Providing valid credentials to this method will return an authentication token that must be provided with all other Web Service calls.
Data Retrieval (Read operations)
There are a number of methods that enable you to read back the full details of an entity. Examples are api/Person/{employeeNo} where providing the correct employee number will return the full Person object and api/Payment/{employeeNo} which will return all the permanent payments in the system for an employee
Data Creation (Write Operations)
It is now possible to create data in InPay via the Web Services. This includes the following the person entity and many of the entities related to the worker (for example pension and absence records)
C# Code
Authenticate
private string Authenticate() { string token = null; if (String.IsNullOrEmpty(username.Text) || String.IsNullOrEmpty(password.Text) || String.IsNullOrEmpty(companyID.Text)) { return "Credentials missing"; } FormUrlEncodedContent content = new FormUrlEncodedContent(new[] { new KeyValuePair<string, string>("grant_type", "password"), }); var request = new HttpRequestMessage(HttpMethod.Post, restURL.Text + "token"); HttpResponseMessage response = client.PostAsync(restURL.Text + "token", content).Result; { Task<Object> res = response.Content.ReadAsAsync<Object>(); Newtonsoft.Json.Linq.JObject jObj = (Newtonsoft.Json.Linq.JObject)res.Result; } else { Console.WriteLine("Auth Was not successful: " + response.StatusCode); } response.Dispose(); } |
---|
Retrieve a Worker
private void GetPerson() try { if (String.IsNullOrEmpty(token)) { output.Text = output.Text + "\r\nAuthentication failed "; } else { output.Text = output.Text + "\r\nAuthenticated: " + token.ToString(); Object person = null; output.Text = output.Text + "\r\nDoing GET from URL: " + url; if (response2.IsSuccessStatusCode) { Task<Object> res2 = response2.Content.ReadAsAsync<Object>(); var results = JObject.Parse(res2.Result.ToString()); { Console.WriteLine("GET Person was not successful: " + results["message"]); } else { var personDetails = results.Value<JObject>("Person").Properties(); var addressDetails = results.Value<JObject>("AddressDetail").Properties(); var employmentDetails = results.Value<JObject>("EmploymentDetail").Properties(); var NIDetails = results.Value<JObject>("NIDetail").Properties(); { var paymentDetails = results.Value<JObject>("PaymentDetail").Properties(); } else { paymentDict = null; } Dictionary<string, string> starterStatementDict; { var starterStatmentDetails = results.Value<JObject>("StarterStatementDetail").Properties(); } else { starterStatementDict = null; } Dictionary<string, string> p45Dict; var p45Details = results.Value<JObject>("P45Detail").Properties(); } p45Dict = null; } var taxDetails = results.Value<JObject>("TaxDetail").Properties(); } taxDict = null; } if (personDict["EmployeeNumber"] != null) employeeNumber.Text = personDict["EmployeeNumber"]; if (Boolean.Parse(personDict["PayslipNotification"])) payslipNotification.CheckState = CheckState.Checked; } payslipNotification.CheckState = CheckState.Unchecked; } } if (Boolean.Parse(personDict["SMSPayslipNotification"])) smsPayslipNotification.CheckState = CheckState.Checked; } smsPayslipNotification.CheckState = CheckState.Unchecked; } } if (personDict["PostponeDate"] != null && personDict["PostponeDate"] != "") postponeDate.CustomFormat = "yyyy/MM/dd"; } postponeDate.CustomFormat = " "; }
} optOutDate.CustomFormat = " "; } addressDate.CustomFormat = "yyyy/MM/dd"; } addressDate.CustomFormat = " "; } if (addressDict["AddressLine1"] != null) addressLine1.Text = addressDict["AddressLine1"]; if (employmentDict["DateOfJoining"] != null) dateOfJoining.Text = employmentDict["DateOfJoining"]; if (Boolean.Parse(employmentDict["IrregularPayments"])) irregularPayments.CheckState = CheckState.Checked; } irregularPayments.CheckState = CheckState.Unchecked; } } if (Boolean.Parse(employmentDict["OffPayrollWorker"])) offPayrollWorker.CheckState = CheckState.Checked; } offPayrollWorker.CheckState = CheckState.Unchecked; } } if (employmentDict["Apprentice"] != null) if (Boolean.TryParse(employmentDict["Apprentice"], out bool apprentice)) if (apprentice) Apprentice.CheckState = CheckState.Checked; } else { Apprentice.CheckState = CheckState.Unchecked; } Apprentice.CheckState = CheckState.Unchecked; } } if (employmentDict["JobTitle"] != null) strtJobTitle.Text = employmentDict["JobTitle"]; if (employmentDict["ContractedHours"] != null) contractedHours.Text = employmentDict["ContractedHours"]; } contractedHours.Text = ""; } if (NIDict["NINumber"] != null) niNumber.Text = NIDict["NINumber"]; if (Boolean.Parse(NIDict["Director"])) { director.CheckState = CheckState.Checked; } director.CheckState = CheckState.Unchecked; } } if (Boolean.Parse(NIDict["NonCumulativeNI"])) nonCumulativeNI.CheckState = CheckState.Checked; } nonCumulativeNI.CheckState = CheckState.Unchecked; } } directorStartDate.CustomFormat = "yyyy/MM/dd"; } directorStartDate.CustomFormat = " "; } if (paymentDict != null) if (paymentDict["AccountName"] != null) accountName.Text = paymentDict["AccountName"]; } if (starterStatementDict != null) if (starterStatementDict["StarterStatement"] != null) starterStatement.Text = starterStatementDict["StarterStatement"]; } if (p45Dict != null) if (p45Dict["P45EmployersReference"] != null) p45EmployersReference.Text = p45Dict["P45EmployersReference"]; { p45LeavingDate.CustomFormat = "yyyy/MM/dd"; } p45LeavingDate.CustomFormat = " "; } if (p45Dict["P45PeriodNo"] != null) p45PeriodNo.Text = p45Dict["P45PeriodNo"]; { if (Boolean.Parse(p45Dict["P45Wk1Mth1"])) p45Wk1Mth1.CheckState = CheckState.Checked; } p45Wk1Mth1.CheckState = CheckState.Unchecked; } } if (p45Dict["P45TaxDistrictNo"] != null) p45TaxDistrictNo.Text = p45Dict["P45TaxDistrictNo"]; } if (taxDict != null) if (taxDict["StartDate"] != null) taxStartDate.Text = taxDict["StartDate"]; { if (Boolean.Parse(taxDict["TaxBasis"])) { taxTaxBasis.CheckState = CheckState.Checked; } taxTaxBasis.CheckState = CheckState.Unchecked; } } } } } Console.WriteLine("GET person was not successful: " + response2.StatusCode); } if (person == null) output.Text = output.Text + "\r\nGet Person returned null"; } Console.WriteLine("Get Person returned:" + person.ToString()); } } } Console.WriteLine("Exception in Get Person:" + ex); } |
---|
Add a Payment
private void btnAddPayment_Click(object sender, EventArgs e) try
} output.Text = output.Text + "\r\nAuthenticated: " + token.ToString(); Object result = null; //Load scheme details in to request body { new KeyValuePair<string, string>("PayElement", paymentPayElement.Text), }); var requestMessage = new HttpRequestMessage(HttpMethod.Put, url); HttpResponseMessage response2 = client.PutAsync(url, content).Result; { Task<Object> res2 = response2.Content.ReadAsAsync<Object>(); } else { Console.WriteLine("Add Payment was not successful: " + response2.StatusCode); } if (result == null) output.Text = output.Text + "\r\nAdd Payment returned null"; } else { Console.WriteLine("Add Payment returned:" + result.ToString()); } } } catch (Exception ex) { Console.WriteLine("Exception in Add Payment:" + ex); } } |
---|
Whilst using the InTime Web Services, some fields have expected values from a range of constants. These are detailed below.
Field | Constant | Comment | Notes |
---|---|---|---|
Client | |||
invoice period | 0 | Weekly | |
1 | Two-Weekly | ||
2 | Four-Weekly | ||
3 | Calendar Monthly | ||
4 | 4-4-5 | ||
Worker | |||
workerType | paye | For PAYE Workers | |
ltd | For Ltd Company Workers | ||
external-contractor | For Non Ltd Company Workers | ||
cis | For CIS Workers | ||
umb | For Workers operating through an Umbrella | You must specify the umbrella against the worker, otherwise the worker will appear as LTD. | |
cisBusinessType | SoleTrader | ||
Company | |||
Trust | |||
Partnership | |||
cisPercentage | 0 | ||
20 | |||
30 | |||
paymentFrequency | weekly | ||
monthly | |||
<InPay Payroll Name> | If InPay connected, for PAYE workers, use the InPay Payroll Name | ||
timesheetsOnInvoices | 0 | Timesheets On Invoices | |
1 | Timesheets Not On Invoices | ||
paperOnInvoices | -1 | Agency Default | |
0 | No Attachments | ||
1 | Attach Paper Timesheets | ||
2 | Attach Expense Group Paper | ||
4 | Attach Expense Receipts Paper | ||
<sum of the above> | Attach the appropriate paper | For example, 5 to attach timesheets and receipts | |
gender | M | ||
F | |||
U | Unkown | ||
LTD invoice period | 0 | Weekly | |
1 | Two-Weekly | ||
2 | Four-Weekly | ||
3 | Calendar Monthly | ||
4 | 4-4-5 | ||
Payment Method | bacs | ||
cheque | |||
cash | |||
chaps | |||
ach | |||
international | |||
building society | |||
Placement | |||
layout | standard | See Maintaining Placements | |
calendar | |||
timesheetDateCalculator | weekly | See Maintaining Placements. You can see all possible values for this in the ui. | |
monthly | |||
<many more> | See UI for all options. | ||
Rates | |||
period | 60 | For hourly rates entered in hours format (hours only or start, break, finish). | |
1440 | For fixed rates of a specified duration entered in decimal format (decimal or tickbox) | ||
periodDuration | <any integer> | The duration in minutes for the fixed rate (e.g. 60 for hours, 480 for a day). | |
timePattern | default | Will use the selected default time pattern | |
<any string> | The string should match the name of a time pattern in the system | ||
timesheetFields | START_FINISH_BREAK | Enter start, break, finish | Only when period above is 60 |
HOURS | Enter hours only | Only when period above is 60 | |
DECIMAL | Enter time as a decimal | Only when period above is 1440 | |
DAY | Tickbox only (equivalent to entering decimals as 1.00) | Only when period above is 1440 |