CURL Import Http request

Describe the problem/error/question

I have a service that runs in .net and service has an integration with sql server which I don’t have direct access just through this api. The Api request is a Post request with header authentication key, and body is just a String of SQL Query. When I test on isomnia it works well, but when I try to transfer the request to http node or just import from Curl Import I got error. So I will paste here the Curl copy from isomnia here.

curl --request POST \
  --url \
  --header 'Authorization: Bearer {{TOKEN_HERE}}' \
  --header 'Content-Type: application/json' \
  --data ''\''"SELECT cli.Cod, cli.Descricao, cli.DataNascimento, venda.ValorContabil, venda.DataEmissao, veiculo.carro from dbo.TAB_Clientes as cli cross apply (Select top 1 nt.ValorContabil, nt.DataEmissao from dbo.TAB_Notas as nt where nt.Situacao = \'\''N\'\'' and nt.CodClientes = cli.Cod and nt.CodNaturezaOperacao in (37, 34, 39) and nt.ValorContabil > 100 order by nt.DataEmissao desc) as venda cross apply (Select top 1 concat(veic.DescricaoVeiculos, \'\'' | \'\'', veic.Placa) as carro from dbo.TAB_ClientesVeiculos as veic where veic.Ativo = 1 and veic.CodClientes = cli.Cod order by Cod desc ) as veiculo where cli.DataNascimento is not NULL	and cli.Ativo = 1 	and cli.Cliente = 1 and month(cli.DataNascimento) = month(cast(\'\''2023-04-24\'\'' as date))"'\'''

Any possible help with that to use on n8n in http node?

inside isomnia this is the request.


What is the error message (if any)?

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.)

Share the output returned by the last node

Information on your n8n setup

  • n8n version:
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app):
  • Operating system:

Hey @rodrigoscdc

You could try something like the below but I suspect the query may need tweaking a bit.

This print show the result in the end of webhook with request from n8n and isomnia


So first request in image is from isomnia and second is from n8n.

This is the body payload

'"SELECT cli.Cod, cli.Descricao, cli.DataNascimento from dbo.TAB_Clientes as cli where cli.DataNascimento is not NULL and cli.Ativo = 1 and cli.Cliente = 1 and month(cli.DataNascimento) = month(cast(\'2023-04-24\' as date))"'

This is my node testing the request.

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