Skip to content

Instantly share code, notes, and snippets.

@portbury
Created March 29, 2021 06:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save portbury/41a02fe35b48e612857df847a7e1fe97 to your computer and use it in GitHub Desktop.
Save portbury/41a02fe35b48e612857df847a7e1fe97 to your computer and use it in GitHub Desktop.
$xeroPayrollAuApi = new XeroAPI\XeroPHP\Api\PayrollAuApi(
new GuzzleHttp\Client(),
$xeroApiConnection["config"]
);
$xero_id = "00000000-aaaa-0000-aaaa-000000000000";
$homeemail = "mark@gmail.com";
$mobile = "0427 123 456";
$employee = new XeroAPI\XeroPHP\Models\PayrollAu\Employee;
$employee->setEmail($homeemail);
$employee->setMobile($mobile);
try {
$resultPayroll = $xeroPayrollAuApi->updateEmployee($xeroApiConnection["tenantId"], $xero_id, $employee);
} catch (Exception $e) {
echo $e->getMessage();
}
@portbury
Copy link
Author

portbury commented Mar 29, 2021

Error being received back when dumping $resultPayroll:

Bad requestError occurred during JSON de/serialization. Cannot deserialize the current JSON object (e.g. {"name":"value"}) into type 'Paycycle.API.DTO.AU.Employee.UpdateEmployeeRequest' because the type requires a JSON array (e.g. [1,2,3]) to deserialize correctly. To fix this error either change the JSON to a JSON array (e.g. [1,2,3]) or change the deserialized type so that it is a normal .NET type (e.g. not a primitive type like integer, not a collection type like an array or List<T>) that can be deserialized from a JSON object. JsonObjectAttribute can also be added to the type to force it to deserialize from a JSON object. Path 'Email', line 1, position 13."

@CorvoJow
Copy link

any updates? i am having a similar problem:

System.Runtime.Serialization.SerializationException: Type definitions should start with a '{', expecting serialized type 'ApiException', got string starting with: oauth_problem=signature_method_rejected&oauth_prob at Xero.Api.Infrastructure.ThirdParty.ServiceStack.Text.Common.DeserializeTypeRefJson.StringToType(Type type, String strType, EmptyCtorDelegate ctorFn, Dictionary2 typeAccessorMap) at Xero.Api.Infrastructure.ThirdParty.ServiceStack.Text.JsonSerializer.DeserializeFromString[T](String value) at Xero.Api.Infrastructure.Http.XeroHttpClient.HandleErrors(Response response) at Xero.Api.Infrastructure.Http.XeroHttpClient.Read[TResult,TResponse](Response response) at Xero.Api.Common.XeroReadEndpoint3.Get(String endpoint, String child) at Xero.Api.Core.XeroCoreApi.get_Organisation()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment