How to send HTTP Request form-data with content-typ application/json and application/xml

Describe the problem/error/question

I can’t send with http request form-data application-json.

Url API Docs: https://suporte.dominioatendimento.com/central/faces/solucao.html?codigo=8476

“Envio de XML”
4 - Clique na guia “Body”, marque a opção “FORM-DATA” e adicione as seguintes Keys:

  • file[] – Marque a opção File - application/xml;
  • query – Marque a opção Text - {“boxeFile”: false} - application/json;
  • fileComplement[] Marque a opção File

What is the error message (if any)?

With Form Urlencoded, i received this error:
HTTP 415 Unsupported Media Type

With Form Data:
HTTP 400 Bad Request

Please share your workflow

(Select the nodes on your canvas and use the keyboard shortcuts CMD+C/CTRL+C and CMD+V/CTRL+V to copy and paste the workflow.)

{
“nodes”: [
{
“parameters”: {
“method”: “POST”,
“url”: “https://api.onvio.com.br/dominio/invoice/v3/batches”,
“sendHeaders”: true,
“headerParameters”: {
“parameters”: [
{
“name”: “x-integration-key”,
“value”: “={{ $(‘Gerar a Key de Integração’).item.json.integrationKey }}”
},
{
“name”: “Authorization”,
“value”: “=Bearer {{ $(‘Token Bearer’).item.json.access_token }}”
}
]
},
“sendBody”: true,
“contentType”: “multipart-form-data”,
“bodyParameters”: {
“parameters”: [
{
“name”: “query”,
“value”: “{"boxeFile": false}”
}
]
},
“options”: {}
},
“type”: “n8n-nodes-base.httpRequest”,
“typeVersion”: 4.2,
“position”: [
-60,
-120
],
“id”: “898165e6-9871-4043-937e-a5ea4641e13e”,
“name”: “HTTP Request”
}
],
“connections”: {
“HTTP Request”: {
“main”: [

]
}
},
“pinData”: {}
}

Share the output returned by the last node

{
“errorMessage”: “The service was not able to process your request”,
“errorDescription”: “HTTP 400 Bad Request”,
“errorDetails”: {
“rawErrorMessage”: [
“500 - "{\"error\":{\"code\":500,\"errors\":,\"message\":\"HTTP 400 Bad Request\"}}"”
],
“httpCode”: “500”
},
“n8nDetails”: {
“nodeName”: “HTTP Request”,
“nodeType”: “n8n-nodes-base.httpRequest”,
“nodeVersion”: 4.2,
“itemIndex”: 0,
“time”: “04/02/2025, 08:21:16”,
“n8nVersion”: “1.70.3 (Self Hosted)”,
“binaryDataMode”: “default”,
“stackTrace”: [
“NodeApiError: The service was not able to process your request”,
" at ExecuteContext.execute (/usr/local/lib/node_modules/n8n/node_modules/n8n-nodes-base/dist/nodes/HttpRequest/V3/HttpRequestV3.node.js:525:33)“,
" at processTicksAndRejections (node:internal/process/task_queues:95:5)”,
" at Workflow.runNode (/usr/local/lib/node_modules/n8n/node_modules/n8n-workflow/dist/Workflow.js:732:19)“,
" at /usr/local/lib/node_modules/n8n/node_modules/n8n-core/dist/WorkflowExecute.js:716:51”,
" at /usr/local/lib/node_modules/n8n/node_modules/n8n-core/dist/WorkflowExecute.js:1147:20"
]
}
}

Information on your n8n setup

  • **n8n version:Version 1.70.3
  • **Database (default: SQLite):default
  • **n8n EXECUTIONS_PROCESS setting (default: own, main):default
  • **Running n8n via (Docker, npm, n8n cloud, desktop app):Docker
  • Operating system: Ubuntu 24.04 LTS (GNU/Linux 6.8.0-51-generic x86_64)

Hey @Gestao_TI fellow Brazilian here :wave:

You need to send it as Form-Data.
And the binary file must already arrive at the node with the correct file type defined.

.
.
:point_right: If my reply answers your question, please remember to mark it as a solution.

Opa…
Bom ver brasileiros por aqui…

Então, já havia tentado o envio desta forma, mas retorna com erro.
Tentei o envio de outras formas pelo http-request, porém sem sucesso…
Pesquisei mais um pouco, e parece que o form-data pelo http-request tem algumas limitações. O campo do query, precisava alterar para content-type applicaiton/Json, mas parece que não tem como fazer isso.

Outra forma que tentei foi por java-script, com for-data, porém também não consegui.

Hey @Gestao_TI ,
Here in the forum it’s required that we only speak English.

I’ve made some adjustments to the node:

But I can see that this request is hard to build.
Try using Postman first, make it work there, and then bring it to n8n.

Postman has this option where you can copy the cURL and almost all fields will be imported correctly in n8n:


Going through the same problem here ;\

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.