Xero - beautiful accounting software

Xero Developer Help Center

Xero Developer Community

Community > Wrapper libraries >

400 - Bad request - Error occurred during JSON deserialization - updateEmployee

Started by Mark Portbury -   in Wrapper libraries


I am migrating my existing app from OAuth1a to OAuth2 using the xero-php-oauth2 library, but I am having trouble updating employee information. Below is some stripped down code:


If I dump $resultPayroll, I can see the following error reported back:

Bad requestError occurred during JSON de/serialization. Cannot deserialize the current JSON object

I have tried searching through the repo for the library but can't find decent documentation on updateEmployee that says anything otherwise. I have tried creating a basic array and submitting as a parameter once JSON encoded, but I got the same result.
Same. I have found through some trial and error that the 400 error goes away when you reduce the scope of the timeframe of the data being pulled. Specifically, I was running a 3 year report before and now can only pull 1 year of data.

The bigger concern here is that the income statement and balance sheet APIs are no longer collating data by month. It's only going to give you the summary of the entire timeframe requested. For instance, if you want your income statement going back three years, you will get the totals for all three years by category rather than a monthly iteration.

Big issue for me trying to consolidate my financials.

Zach Rochon