409 Conflict when trying to update Employee Payroll Details

This thread is now closed to new comments.
Some of the links and information provided in this thread may no longer be available or relevant.
If you have a question please start a new post.
kjm
Trusted Cover User
160 Posts
Trusted Cover User
Australia
Trusted Cover User

160Posts

18Kudos

2Solutions

Solved: Go to Solution

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

 

2 REPLIES 2
Hannah_B
MYOB Moderator
142 Posts
MYOB Moderator
Australia
MYOB Moderator

142Posts

33Kudos

25Solutions

Accepted Solution Solved

Re: 409 Conflict when trying to update Employee Payroll Details

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. 


Thanks,
@Hannah_B


MYOB API Specialist


MYOB API Support Centre|MYOB App Marketplace|MYOB AccountRight API Endpoint Doc's



Did my answer help?


Mark it as a Solution

kjm
Trusted Cover User
160 Posts
Trusted Cover User
Australia
Trusted Cover User

160Posts

18Kudos

2Solutions

Re: 409 Conflict when trying to update Employee Payroll Details

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?

Didn't find your answer here?

Try using advanced search to find a post more easily Advanced Search
or
Get the conversation started and make a new post Start a Post