-
Notifications
You must be signed in to change notification settings - Fork 91
Description
SDK you're using (please complete the following information):
- Version: 12.0.0
- Previous Working Version: 11.0.0
- Language: Java 17
- Framework: Spring Boot
Describe the bug
After upgrading from Xero Java SDK v11.0.0 to v12.0.0, some outgoing API calls to Xero (for example, PayrollUkApi.createPayRunCalendar) fail with the following error:
com.google.api.client.http.HttpResponseException: 415 Unsupported Media Type
The same API calls work correctly when using SDK v11.0.0.
On investigation, we found that SDK v12 automatically adds a Content-Type header to outgoing requests, whereas v11 did not.
When this header is removed manually and the same request is sent via Postman, the API succeeds.
To Reproduce
Steps to reproduce the behavior:
- Use Xero Java SDK v12.0.0
- Initialize a Xero API client (e.g.,PayrollUkApi)
- Call an endpoint such as:
PayrollUkApi.createPayRunCalendar - Observe the response:
com.google.api.client.http.HttpResponseException: 415 Unsupported Media Type - Repeat the same using SDK v11.0.0 — the request succeeds.
Expected behavior
API calls that worked in v11.0.0 should continue to work in v12.0.0.
Screenshots
If applicable, add screenshots to help explain your problem.
Additional context
We compared the raw outgoing requests between versions.
v12.0.0 (fails):
curl -X POST 'https://api.xero.com/payroll.xro/2.0/PayRunCalendars' \
-H 'accept: application/json' \
-H 'accept-encoding: gzip' \
-H 'content-type: application/json' \
-H 'user-agent: Default [Xero-Java-12.0.0]' \
-H 'xero-tenant-id: <tenant-id>' \
-H 'idempotency-key: null' \
-H 'Authorization: Bearer <token>' \
-d '{"name":"Cal ppMqMv","calendarType":"Weekly","periodStartDate":"2025-10-20","periodEndDate":"2025-10-27","paymentDate":"2025-10-27"}'
v11.0.0 (works):
curl -X POST 'https://api.xero.com/payroll.xro/2.0/PayRunCalendars' \
-H 'accept: application/json' \
-H 'accept-encoding: gzip' \
-H 'user-agent: Default [Xero-Java-11.0.0]' \
-H 'xero-tenant-id: <tenant-id>' \
-H 'idempotency-key: null' \
-H 'Authorization: Bearer <token>' \
-d '{"name":"Cal Eimjzp","calendarType":"Weekly","periodStartDate":"2025-10-20","periodEndDate":"2025-10-27","paymentDate":"2025-10-27"}'
The only difference is the Content-Type header in v12. Removing it makes the request succeed