Getting a step closer.
I have setup the xero explorer and got the credentials and added to an http request node.
the url is https://api.xero.com/api.xro/2.0/Invoices
If I run a get request I get the invoices so the auth is setup.
Using a code node I output
[
{
"Type": "ACCREC",
"Contact": {
"ContactID": "02f7759f-211e-44ba-8d00-a38cf1112c4d"
},
"Date": "2024-12-03",
"DueDate": "2024-12-31",
"LineAmountTypes": "Exclusive",
"LineItems": [
{
"ItemCode": "1002",
"Description": "TrackingID1234567",
"Quantity": 1,
"UnitAmount": 110,
"AccountCode": "202",
"TaxType": "NONE",
"LineAmount": 110
},
{
"ItemCode": "1002",
"Description": "newTracking No",
"Quantity": 1,
"UnitAmount": 21.34,
"AccountCode": "202",
"TaxType": "NONE",
"LineAmount": 21.34
}
],
"CurrencyCode": "GBP",
"Status": "DRAFT"
}
]
If I send a PUT with body
{{ $json.toJsonString() }}
Which gives me
{"Type":"ACCREC","Contact":{"ContactID":"02f7759f-211e-44ba-8d00-a38cf1112c4d"},"Date":"2024-12-03","DueDate":"2024-12-31","LineAmountTypes":"Exclusive","LineItems":[{"ItemCode":"1002","Description":"TrackingID1234567","Quantity":1,"UnitAmount":110,"AccountCode":"202","TaxType":"NONE","LineAmount":110},{"ItemCode":"1002","Description":"newTracking No","Quantity":1,"UnitAmount":21.34,"AccountCode":"202","TaxType":"NONE","LineAmount":21.34}],"CurrencyCode":"GBP","Status":"DRAFT"}
I get the error
{
"errorMessage": "Bad request - please check your parameters",
"errorDescription": "A validation exception occurred",
"errorDetails": {
"rawErrorMessage": [
"400 - \"{\\r\\n \\\"ErrorNumber\\\": 10,\\r\\n \\\"Type\\\": \\\"ValidationException\\\",\\r\\n \\\"Message\\\": \\\"A validation exception occurred\\\",\\r\\n \\\"Elements\\\": [\\r\\n {\\r\\n \\\"InvoiceID\\\": \\\"00000000-0000-0000-0000-000000000000\\\",\\r\\n \\\"Payments\\\": [],\\r\\n \\\"CreditNotes\\\": [],\\r\\n \\\"Prepayments\\\": [],\\r\\n \\\"Overpayments\\\": [],\\r\\n \\\"IsDiscounted\\\": false,\\r\\n \\\"InvoiceAddresses\\\": [],\\r\\n \\\"HasErrors\\\": true,\\r\\n \\\"InvoicePaymentServices\\\": [],\\r\\n \\\"Status\\\": \\\"DRAFT\\\",\\r\\n \\\"LineItems\\\": [],\\r\\n \\\"ValidationErrors\\\": [\\r\\n {\\r\\n \\\"Message\\\": \\\"Invoice Type must be specified\\\"\\r\\n }\\r\\n ]\\r\\n }\\r\\n ]\\r\\n}\""
],
"httpCode": "400"
},
"n8nDetails": {
"nodeName": "HTTP Request",
"nodeType": "n8n-nodes-base.httpRequest",
"nodeVersion": 4.2,
"itemIndex": 0,
"time": "05/12/2024, 00:08:09",
"n8nVersion": "1.69.2 (Self Hosted)",
"binaryDataMode": "default",
"stackTrace": [
"NodeApiError: Bad request - please check your parameters",
" at Object.requestWithAuthentication (C:\\Users\\sales\\AppData\\Roaming\\npm\\node_modules\\n8n\\node_modules\\n8n-core\\src\\NodeExecuteFunctions.ts:2020:10)",
" at processTicksAndRejections (node:internal/process/task_queues:95:5)",
" at Object.requestWithAuthentication (C:\\Users\\sales\\AppData\\Roaming\\npm\\node_modules\\n8n\\node_modules\\n8n-core\\src\\NodeExecuteFunctions.ts:3324:11)"
]
}
}
If I paste in the json ( which is the same json that works in the explorer ) it fails.
What am I missing here please.