說明問題/錯誤/問題
我需要執行一個 HTTP 請求,其中伺服器期望我在同一個欄位資料下提供多個檔案。檔案的數量不是靜態的,所以我無法將每個檔案對應到 n8n 節點中的一個欄位。這甚至可能透過 http 節點實現嗎,還是我應該使用程式碼節點?
錯誤訊息是什麼(如有)?
我試過這樣做,但顯然如果我有超過 1 個檔案,我會收到一個錯誤,說 id 為的二進位檔案不存在。
請分享您的工作流程
{
"nodes": [
{
"parameters": {},
"type": "n8n-nodes-base.manualTrigger",
"typeVersion": 1,
"position": [
0,
0
],
"id": "fb16aeab-57ba-485f-8c6e-7bc015bd1e28",
"name": "When clicking 'Execute workflow'"
},
{
"parameters": {
"method": "POST",
"url": "=http://example.org/project/tag",
"sendBody": true,
"contentType": "multipart-form-data",
"bodyParameters": {
"parameters": [
{
"parameterType": "formBinaryData",
"name": "data",
"inputDataFieldName": "={{ Object.keys($binary).filter((k) =
> k !== 'params').join(',') }}"
},
{
"parameterType": "formBinaryData",
"name": "params",
"inputDataFieldName": "params"
},
{
"name": "aggregate",
"value": "true"
}
]
},
"options": {
"response": {
"response": {
"fullResponse": true,
"neverError": true
}
}
}
},
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.3,
"position": [
448,
0
],
"id": "e2323076-8b22-4872-8eb3-7b1710a8a987",
"name": "Async Tagging"
},
{
"parameters": {
"jsCode": "const source = $('When Executed by Another Workflow').first();\nconst sourceBinary = { ...(source.binary || {}) };\nconst paramsPayload = {\n projectId: [source.json.fields.projectID],\n language: source.json.fields.language,\n filterNestedConcepts: source.json.fields.FilterNestedConcepts,\n numberOfConcepts: source.json.fields.LabelsPerPage,\n numberOfTerms: source.json.fields.LabelsPerPage,\n};\n\nsourceBinary.params = {\n data: Buffer.from(JSON.stringify(paramsPayload), 'utf8').toString('base64'),\n mimeType: 'application/json',\n fileName: 'params.json',\n fileExtension: 'json',\n};\nreturn [\n {\n binary: sourceBinary,\n },\n];"
},
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
224,
0
],
"id": "100a0875-9bce-4790-be6c-da7a31407523",
"name": "Prepare Extraction Input"
}
],
"connections": {
"When clicking 'Execute workflow'": {
"main": [
[
{
"node": "Prepare Extraction Input",
"type": "main",
"index": 0
}
]
]
},
"Prepare Extraction Input": {
"main": [
[
{
"node": "Async Tagging",
"type": "main",
"index": 0
}
]
]
}
},
"pinData": {},
"meta": {
"instanceId": "982a83c4fa14b8860ea8391b8f766ad449d7431aac64126d0b9fc936877b58be"
}
}
關於您的 n8n 設定的資訊
- n8n 版本: 2.21.7
- 資料庫(預設:SQLite): postgres
- n8n EXECUTIONS_PROCESS 設定(預設:own, main): own
- 執行 n8n 的方式(Docker、npm、n8n cloud、桌面應用程式): docker
- 作業系統: macOS
