Forum Discussion

kjm's avatar
kjm
Trusted Cover User
3 years ago

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 error409 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. 

2 Replies

Replies have been turned off for this discussion
  • Hannah_B's avatar
    Hannah_B
    MYOB Moderator

    HI kjm

     

    Thanks for sending that through. The error409 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. 

    • kjm's avatar
      kjm
      Trusted Cover User

      EDIT: I just removed setting the RowVersion. The doco is pretty light on this and it does say the row version must be provided when using a put which led me to belive I had to provide it...my fault but the api doco could be clearer on this

       

      ok. Thanks for that

       

      I am manually setting the row version to 10. What sahould I be setting it to? should I just be setting it to the value which is retrieved? from what I recall it was something like a negative number for example "-64564646456546" 

       

      Is this something I shold not change ? or is this some kind of time calculation or something?