Configure an http node

Hello everyone,

I need help to configure an http node.
I would like to be able to upload a binary file that I receive in my webhook into GLPI using the API.

1. GLPI API

After consulting the GLPI documentation, I found the method to use (below :arrow_heading_down:)

$ curl -X POST \
-H 'Content-Type: multipart/form-data' \
-H "Session-Token: MySessionToken" \
-H "App-Token: MyAppToken" \
-F 'uploadManifest={"input": {"name": "Uploaded document", "_filename" : ["file.txt"]}};type=application/json' \
-F 'filename[0]=@file.txt' \
'http://path/to/glpi/apirest.php/Document/'

So I decided to test it first with a simple curl to make sure the API was working properly.

To do this, I ran the following curl (which I adapted for a Windows CMD) :arrow_heading_down:

curl -X POST ^
  -H "Session-Token: MySessionToken" ^
  -H "App-Token: MyAppToken" ^
  -F "uploadManifest={\"input\": {\"name\": \"Test\", \"_filename\": [\"test.txt\"]}}" ^
  -F "filename[0]=@C:\Users\x\Downloads\test.txt" ^
  https://myglpi.com/apirest.php/Document

It worked perfectly :white_check_mark:

{"id":110768,"message":"Item successfully added: Test (110768)","upload_result":{"filename":[{"name":"6808f8d90ae8a2.47080004test.txt","size":3250,"type":"text/plain","url":"https://myglpi.com/files/6808f8d90ae8a2.47080004test.txt","deleteUrl":"https://myglpi.com/apirest.php?filenam=6808f8d90ae8a2.47080004test.txt","deleteType":"DELETE","prefix":"6808f8d90ae8a2.47080004","display":"test.txt","filesize":"3.17 KiB","id":"docfilename2129973353"}]}}

So I’m sure the API is working properly :white_check_mark:

2. My Workflow

So I made my flow and configure my nodes but I can’t get the same result.

All I do is have errors that I don’t understand.

3. Output :x:

I’m 99% sure it’s a “ fake error ”.
But therefore it doesn’t help me find the problem …

4. Information on my Self-Hosted n8n setup

  • n8n version: 1.89.2 (Self-Hosted)
  • Database (default: SQLite): default
  • n8n EXECUTIONS_PROCESS setting (default: own, main): default
  • Running n8n via (Docker, npm, n8n cloud, desktop app): docker desktop
  • Operating system: windows

I’d be very grateful if someone could tell me what I’m doing wrong or how I’m supposed to configure my http node.
Thank you in advance to anyone who takes the time to help me. :grinning:

ENGT

PS: I’ve replaced the tokens and url for security reasons

Hello,

Thank you for your comment.

The file weighs 4 KB, it’s a small test .txt.

When I made the Curl I used the same file and it worked.

(That’s why I assume it’s a false error)

Regards,

ENGT

Hi,

Yes thank you, i saw it afterwards. my apologies.

BTW i saw that your upload manifest is not the same as the one in your curl
the part with application/json is missing.

ok, i saw you mix and match things… to keep things simple :slight_smile:

reg,
j.

Hello,

I found a solution by using other nodes and changing my workflow

  1. I had to build a custom image of n8n + curl, so that I could curl from my container.
  2. Then write the file I get from the webhook into my container, read it and get a file path. (which I couldn’t get from my webhook)
  3. And finally, curl from the “execute command” node.

I’d be very interested to know if I’m just bad or if what I wanted to do in the first place just isn’t possible with an http request node. (And if that’s not possible, how can I ask for it to be developed in the future?)