Convert this Python command to an HTTP Request

Describe the problem/error/question

I can’t seem to figure out the settings to put in an HTTP Request node that matches this python code

with open(file='test_document.pdf', mode='rb') as file_object:
    response ='', auth=('username', 'password'), files={'file_new': file_object}, data={'action_name': append})

What is the error message (if any)?

ERROR: Bad request - please check your parameters
400 - "{\"action_name\":[\"This field is required.\"],\"file_new\":[\"No file was submitted.\"]}"

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: 1.22.6
  • Database (default: SQLite): PostGreSQL
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app): Docker
  • Operating system: Ubuntu 22.04

@dbayer , if I’m not mistaken it would be this

Surely, you would need to fill in the missing bits with the actual values (credentials and the binary file).


Hello @ihortom

Thanks for the help. That almost worked, but not quite.

Here’s my workflow

After changing the parameters to your suggestion, this is the error message I’m getting

ERROR: The resource you are requesting could not be found
404 - "{\"detail\":\"Not found.\"}"
1 Like

Never mind. I was pointing to the wrong field for where to send the file. Once I fixed that, it worked perfectly!


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