Describe the issue/error/question
I need to make a multipart request. For testing purpose I have created a code node using axios request. When executing the node I get an error. Posting the same via Postman is working. The error is created whatever content I put into the JSON.
console.log(options) is working and seems to be the correct JSON structure
console.log(response) is not showing anything.
Any ideas?
What is the error message (if any)?
Error: Request failed with status code 500
at createError (C:\Users\offic\AppData\Local\Programs\n8n\resources\app\node_modules\axios\lib\core\createError.js:16:15)
at settle (C:\Users\offic\AppData\Local\Programs\n8n\resources\app\node_modules\axios\lib\core\settle.js:17:12)
at IncomingMessage.handleStreamEnd (C:\Users\offic\AppData\Local\Programs\n8n\resources\app\node_modules\axios\lib\adapters\http.js:269:11)
at IncomingMessage.emit (node:events:406:35)
at IncomingMessage.emit (node:domain:470:12)
at endReadableNT (node:internal/streams/readable:1331:12)
at processTicksAndRejections (node:internal/process/task_queues:83:21)
Please share the workflow
const options = {
url: "https://my.sevdesk.de/api/v1/Voucher/Factory/saveVoucher",
headers: {
"Authorization": 'xxxxx',
"Content-Type": "application/json"
},
body:
{
"voucher": {
"supplier": {
"id": 54106494,
"objectName": "Contact"
},
"supplierName": "ÖGK",
"description": "Auszahlungsjournal",
"status": 50,
"creditDebit": "C",
"voucherType": "VOU",
"paymentDeadline": null,
"objectName": "Voucher",
"mapAll": "true",
"taxType": "default"
},
"voucherPosSave": [
{
"accountingType": {
"id": 58,
"objectName": "AccountingType"
},
"taxRate": 20,
"sum": null,
"isAsset": "false",
"objectName": "VoucherPos",
"net": "true",
"mapAll": "true",
"taxType": "ss",
"creditDebit": "D",
"hidden": "0",
"costCentre": {
"id": 101640,
"objectName": "CostCentre"
}
}
],
"voucherPosDelete": null,
"filename": "7bec61fff8008c874f5b19d5d9cc5d11.pdf"
},
method: "POST"
};
console.log(options);
const response = await this.helpers.httpRequest(options);
console.log(response);
return this.prepareOutputData(response);
Share the output returned by the last node
Information on your n8n setup
- n8n version: Desktop app for Windows 1.7.0
- Database you’re using (default: SQLite): default