Describe the problem/error/question
I’m trying to upload a file to Quickbooks via API and attach it to a bill. I can upload a file using the normal method of using Form-Data but this just uploads and does not attach.
The QB docs suggest it needs to be send in the following format
--YOjcLaTlykb6OxfYJx4O07j1MweeMFem
Content-Disposition: form-data; name="file_metadata_01"; filename="attachment.json"
Content-Type: application/json; charset=UTF-8
Content-Transfer-Encoding: 8bit
{
"AttachableRef": [
{
"EntityRef": {
"type": "Invoice",
"value": "95"
}
}
],
"FileName": "receipt_nov15.jpg",
"ContentType": "image/jpg"
}
--YOjcLaTlykb6OxfYJx4O07j1MweeMFem
Content-Disposition: form-data; name="file_content_01"; filename="receipt_nov15.jpg"
Content-Type: image/jpeg
Content-Transfer-Encoding: base64
<insert base-64 encoded file content here>
--YOjcLaTlykb6OxfYJx4O07j1MweeMFem--
So, I tried this with Raw content and also used the exact same example in Postman (BTW - there is binary data where it needs to be inserted).
It works in Postman but not in N8N.
I’ve tried sending the same to Webhook site and I think I have the issue - the N8N node is adding it’s won boundary header with a different identifier, meaning the content that is received is empty.
Please share your workflow
Here is my node that I have set up:
Share the output returned by the last node
It returns:
[
{
"body": {
"time": "2024-08-17T04:03:22.352-07:00"
},
"headers": {
"date": "Sat, 17 Aug 2024 11:03:22 GMT",
"content-type": "application/json;charset=utf-8",
"transfer-encoding": "chunked",
"connection": "close",
"x-spanid": "380df781-c264-2fa2-7eea-783863bb9cc3",
"x-amzn-trace-id": "Root=1-66c08378-06d1f90d194f45bf517eb06c",
"x-content-type-options": "nosniff",
"x-xss-protection": "1; mode=block",
"qbo-version": "2034.145",
"service-time": "total=1421, db=17",
"expires": "0",
"cache-control": "max-age=0, no-cache, no-store, must-revalidate, private",
"x-envoy-upstream-service-time": "431",
"strict-transport-security": "max-age=31536000",
"intuit_tid": "1-66c08378-06d1f90d194f45bf517eb06c",
"x-request-id": "1-66c08378-06d1f90d194f45bf517eb06c",
"server": "istio-envoy"
},
"statusCode": 200,
"statusMessage": "OK"
}
]
but should return:
{
"AttachableResponse": [
{
"Attachable": {
"FileName": "receipt_nov15.jpg",
"FileAccessUri": "...",
"TempDownloadUri": "https://...",
"Size": 1594261,
"ContentType": "image/jpeg",
"ThumbnailFileAccessUri": "...",
"domain": "QBO",
"sparse": false,
"Id": "100000000004190865",
"SyncToken": "0",
"MetaData": {
"CreateTime": "2015-11-16T10:59:02-08:00",
"LastUpdatedTime": "2015-11-16T10:59:02-08:00"
},
"AttachableRef": [
{
"EntityRef": {
"value": "95",
"type": "Invoice"
},
"IncludeOnSend": false
}
]
}
}
],
"time": "2015-11-16T10:58:58.100-08:00"
}
Information on your n8n setup
- n8nVersion: 1.53.2
- platform: docker (self-hosted)
- nodeJsVersion: 20.15.0
- database: sqlite
- executionMode: regular
- concurrency: -1
- license: community
- consumerId: unknown
Any help you can offer would be great - I’ve been at this for hours but know there is a way around it.