409 Conflict when trying to update Employee Payroll Details
I am using the C# SDK Api communicating to a local filew on my network and I can successfully create and then get the employee. I want to then update that employees PayrollDetails. However, I get a 409 conflic error and I cannot see what I am doing wrong. Below is my code. The repositories definately return the correct employee and payroll details but when I call the update method it gives me a 409 conflict error and nothing else
I create the employee first and then do another call to get the employee. This allows me to then populate the payrolldetails
Should I be creating the employee and the payroll details at the same time? The endpoint doco says that payroll details are only GET, PUT
//gets the employee var employee = _myobEmployeeRepository.Get(uri); //gets the payroll details of the employee var prd =_myobEmployeeRepository.GetPayrollDetails(employee.EmployeePayrollDetails.UID); prd.Employee = new EmployeeLink{UID = employee.UID}; prd.DateOfBirth = DateTime.Parse(request.MyobEmployeeDto.DateOfBirth); prd.StartDate = DateTime.Now; prd.EmploymentBasis = EmploymentBasis.Individual; prd.EmploymentCategory = EmploymentCategory.Permanent; prd.PaySlipDelivery = PaySlipDelivery.ToBeEmailed; prd.PaySlipEmail = request.MyobEmployeeDto.PrimaryEmail; prd.RowVersion = "10"; //attempt to update var service = new EmployeePayrollDetailsService(); var e = service.Update(CompanyFile, employeePayrollDetails, Credentials); //throws 409 conflict
HI kjm
Thanks for sending that through. The error 409 IncorrectRowVersionSupplied is generally always the result of the record being changed and the row version that you are using becomes out of date.
Taking a look at your request, there is nothing that we can stop that looks out of place. We recommend that you do a GET request first and use the response JSON to check that the row version that you are using matches the GET before your PUT request.
If you still continue to receive this error you can create a support request with us HERE and we can have a more in-depth look at what is occurring.