# HTTP POST multipart-form-data via msg.payload

**URL:** <https://discourse.nodered.org/t/http-post-multipart-form-data-via-msg-payload/72250>\
**Category:** General\
**Tags:** http-request\
**Created:** [15 December 2022 12:07 UTC](https://discourse.nodered.org/t/http-post-multipart-form-data-via-msg-payload/72250 "2022-12-15T12:07:11Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![nit-cyber](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/nit-cyber/32/72630_2.png) [@nit-cyber](https://discourse.nodered.org/u/nit-cyber)\
**Post date:** [15 December 2022 12:07 UTC](https://discourse.nodered.org/t/http-post-multipart-form-data-via-msg-payload/72250/1 "2022-12-15T12:07:11Z")

</div>

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/8/a/8af2aa18fe443acd9a21f0cdd975d9888db4a6f0.png)

---

<div class="post-metadata">

**Author:** ![nit-cyber](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/nit-cyber/32/72630_2.png) [@nit-cyber](https://discourse.nodered.org/u/nit-cyber)\
**Post date:** [15 December 2022 12:12 UTC](https://discourse.nodered.org/t/http-post-multipart-form-data-via-msg-payload/72250/2 "2022-12-15T12:12:12Z")

</div>

using this node shown below:  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/e/e/eec2a1de960c1053e0f8384335fa6e3991f1b3b5.png)

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/e/1/e1d5e33b2d399ce90344e5f492d0e61ce812ff79.png)

I want to pass the url using the msg.payload to this node as we do with http request node but in this url is not acceptable via function node or change node.

Any one can suggest the suitable way please

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [15 December 2022 14:23 UTC](https://discourse.nodered.org/t/http-post-multipart-form-data-via-msg-payload/72250/3 "2022-12-15T14:23:37Z")

</div>

Does that node have built in help on the sidebar?  
What does it say?

By the looks of whatever that node is (you didnt provide a link to it in the flows library so I cant check it out) - but it looks to be a fork of the official HTTP Request node so I assume it uses mustache syntax in the UTL too - have you tried entering `{{{msg.url}}}` or `{{{url}}}` or `{{{payload}}}`?

---

<div class="post-metadata">

**Author:** ![nit-cyber](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/nit-cyber/32/72630_2.png) [@nit-cyber](https://discourse.nodered.org/u/nit-cyber)\
**Post date:** [15 December 2022 15:22 UTC](https://discourse.nodered.org/t/http-post-multipart-form-data-via-msg-payload/72250/4 "2022-12-15T15:22:31Z")

</div>

Hi Steve thanks for replying ok let me try with the way you said. this node is used for multipart form data to get form based api to work

> **[node-red-contrib-send-multipart-formdata](https://flows.nodered.org/node/node-red-contrib-send-multipart-formdata)**
>
> NodeRed node for sending HTTP POST requests with multipart/formdata body

this the link I get the node

Code:

```auto
[
    {
        "id": "6e4d8c8220a9787e",
        "type": "group",
        "z": "3173ae332a4790bc",
        "style": {
            "stroke": "#999999",
            "stroke-opacity": "1",
            "fill": "none",
            "fill-opacity": "1",
            "label": true,
            "label-position": "nw",
            "color": "#a4a4a4"
        },
        "nodes": [
            "c7c0cf40cc247303",
            "ba5d8d21cb15e087",
            "4aae5351f23fc98e",
            "373f2919823d3ed1"
        ],
        "x": 174,
        "y": 1079,
        "w": 552,
        "h": 82
    },
    {
        "id": "c7c0cf40cc247303",
        "type": "http-send-multipart-formdata",
        "z": "3173ae332a4790bc",
        "g": "6e4d8c8220a9787e",
        "name": "redirect",
        "ret": "obj",
        "headers": [
            {
                "name": "",
                "value": ""
            },
            {
                "name": "",
                "value": ""
            },
            {
                "name": "",
                "value": ""
            }
        ],
        "formdata": [
            {
                "name": "api_key",
                "value": ""
            },
            {
                "name": "",
                "value": ""
            },
            {
                "name": "workflow_id",
                "value": ""
            },
            {
                "name": "userfile_url",
                "value": ""
            },
            {
                "name": "userfile_url",
                "value": ""
            },
            {
                "name": "",
                "value": ""
            },
            {
                "name": "page",
                "value": ""
            },
            {
                "name": "items_per_page",
                "value": ""
            },
            {
                "name": "documents_order",
                "value": ""
            },
            {
                "name": "detailed",
                "value": ""
            },
            {
                "name": "locations",
                "value": ""
            },
            {
                "name": "deleted",
                "value": ""
            },
            {
                "name": "deleted",
                "value": ""
            }
        ],
        "url": "",
        "credentials": {},
        "x": 465,
        "y": 1120,
        "wires": [
            [
                "ba5d8d21cb15e087"
            ]
        ],
        "l": false
    },
    {
        "id": "ba5d8d21cb15e087",
        "type": "debug",
        "z": "3173ae332a4790bc",
        "g": "6e4d8c8220a9787e",
        "name": "debug 435",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "true",
        "targetType": "full",
        "statusVal": "",
        "statusType": "auto",
        "x": 610,
        "y": 1120,
        "wires": []
    },
    {
        "id": "4aae5351f23fc98e",
        "type": "inject",
        "z": "3173ae332a4790bc",
        "g": "6e4d8c8220a9787e",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "",
        "payloadType": "date",
        "x": 280,
        "y": 1120,
        "wires": [
            [
                "373f2919823d3ed1"
            ]
        ]
    },
    {
        "id": "373f2919823d3ed1",
        "type": "change",
        "z": "3173ae332a4790bc",
        "g": "6e4d8c8220a9787e",
        "name": "",
        "rules": [
            {
                "t": "set",
                "p": "url",
                "pt": "msg",
                "to": "",
                "tot": "str"
            },
            {
                "t": "set",
                "p": "api_key",
                "pt": "msg",
                "to": "7239",
                "tot": "str"
            },
            {
                "t": "set",
                "p": "method",
                "pt": "msg",
                "to": "POST",
                "tot": "str"
            },
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "",
                "tot": "str"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 395,
        "y": 1120,
        "wires": [
            [
                "c7c0cf40cc247303"
            ]
        ],
        "l": false
    }
]

```

---

<div class="post-metadata">

**Author:** ![nit-cyber](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/nit-cyber/32/72630_2.png) [@nit-cyber](https://discourse.nodered.org/u/nit-cyber)\
**Post date:** [15 December 2022 15:23 UTC](https://discourse.nodered.org/t/http-post-multipart-form-data-via-msg-payload/72250/5 "2022-12-15T15:23:12Z")

</div>

I want to fill the values in formdata using change node

---

<div class="post-metadata">

**Author:** ![nit-cyber](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/nit-cyber/32/72630_2.png) [@nit-cyber](https://discourse.nodered.org/u/nit-cyber)\
**Post date:** [15 December 2022 15:31 UTC](https://discourse.nodered.org/t/http-post-multipart-form-data-via-msg-payload/72250/6 "2022-12-15T15:31:15Z")

</div>

> [@Steve-Mcl](#):
>
> {{{msg.url}}}

tried this it is not working please check whether there is any bug in node

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [15 December 2022 15:34 UTC](https://discourse.nodered.org/t/http-post-multipart-form-data-via-msg-payload/72250/7 "2022-12-15T15:34:54Z")

</div>

Looking at the nodes src code, it does not support dynamic URL - only fixed as entered on the form...

> <https://github.com/kirillbunin/node-red-contrib-send-multipart-formdata/blob/master/http-send-multipart-formdata.js#L37-L44>

You have choices...

1. use the built in http request node.
2. raise an issue on the git repository & wait for this to be implemented.

---

<div class="post-metadata">

**Author:** ![nit-cyber](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/nit-cyber/32/72630_2.png) [@nit-cyber](https://discourse.nodered.org/u/nit-cyber)\
**Post date:** [15 December 2022 15:36 UTC](https://discourse.nodered.org/t/http-post-multipart-form-data-via-msg-payload/72250/8 "2022-12-15T15:36:04Z")

</div>

built in http request node is not working for the required form based api call if there is way please tell

---

<div class="post-metadata">

**Author:** ![nit-cyber](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/nit-cyber/32/72630_2.png) [@nit-cyber](https://discourse.nodered.org/u/nit-cyber)\
**Post date:** [15 December 2022 15:38 UTC](https://discourse.nodered.org/t/http-post-multipart-form-data-via-msg-payload/72250/9 "2022-12-15T15:38:49Z")

</div>

API Previewer

- All requests must be https POST
- All requests must use the body in the POST
- All requests must use the form-data option
- For JSON responses include in the header _ **Accept: application/json** _

---

<div class="post-metadata">

**Author:** ![nit-cyber](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/nit-cyber/32/72630_2.png) [@nit-cyber](https://discourse.nodered.org/u/nit-cyber)\
**Post date:** [15 December 2022 15:40 UTC](https://discourse.nodered.org/t/http-post-multipart-form-data-via-msg-payload/72250/10 "2022-12-15T15:40:12Z")

</div>

this is mandatory for api call and I tried with builtin http request but didnt work so i searched this node

---

<div class="post-metadata">

**Author:** ![nit-cyber](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/nit-cyber/32/72630_2.png) [@nit-cyber](https://discourse.nodered.org/u/nit-cyber)\
**Post date:** [15 December 2022 15:41 UTC](https://discourse.nodered.org/t/http-post-multipart-form-data-via-msg-payload/72250/11 "2022-12-15T15:41:41Z")

</div>

can we work on source code to get dynamic URL also other things are not dynamic in this node

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [15 December 2022 15:54 UTC](https://discourse.nodered.org/t/http-post-multipart-form-data-via-msg-payload/72250/12 "2022-12-15T15:54:27Z")

</div>

### Short Version...

The HTTP Request node can do this.

  

### Long Version...

Why did it not work?

What problems did you encounter?

Did you open a thread on the forum about your problem with HTTP Request node?

  

> [@nit-cyber](#):
>
> - All requests must be https POST

HTTP Request node can do this

> [@nit-cyber](#):
>
> All requests must use the body in the POST

HTTP Request node can do this

> [@nit-cyber](#):
>
> All requests must use the form-data option

HTTP Request node can do this (set header multipart/form-data)

> [@nit-cyber](#):
>
> By default, responses will be in XML

Fine!

> [@nit-cyber](#):
>
> For JSON responses include in the header _ **Accept: application/json** _

HTTP Request node can do this (set appropriate header)

> [@nit-cyber](#):
>
> Response status codes basically follow RFC7231

So use change node AFTER http request to check the status code & act accordingly.

---

<div class="post-metadata">

**Author:** ![nit-cyber](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/nit-cyber/32/72630_2.png) [@nit-cyber](https://discourse.nodered.org/u/nit-cyber)\
**Post date:** [15 December 2022 15:56 UTC](https://discourse.nodered.org/t/http-post-multipart-form-data-via-msg-payload/72250/13 "2022-12-15T15:56:29Z")

</div>

ok I am trying again. How to pass form data fields as we do in http send multipart node  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/4/9/49d29d7a993d32352ab2a2ac9274f7b91a54e43b.png)

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [15 December 2022 16:10 UTC](https://discourse.nodered.org/t/http-post-multipart-form-data-via-msg-payload/72250/14 "2022-12-15T16:10:11Z")

</div>

Built in help is your friend...

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/3/8/3800b5f654d24b65f74ec750568ad276f769a00c.png)

And so are the forum & google...

- [multipartform data - How to create multipart HTTP request in Node-RED - Stack Overflow](https://stackoverflow.com/questions/55698724/how-to-create-multipart-http-request-in-node-red)
- [Search results for 'multipart request order:latest' - Node-RED Forum](https://discourse.nodered.org/search?q=multipart%20request%20order%3Alatest)

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [16 December 2022 12:09 UTC](https://discourse.nodered.org/t/http-post-multipart-form-data-via-msg-payload/72250/16 "2022-12-16T12:09:11Z")

</div>

> [@nit-cyber](#):
>
> please help me to make http builtin node to work like http send-multipart-formdata

Here is a working demo...  
 ![chrome_ZanXBfvTa0](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/7/3/7306e57aa566ae5bf6335ac2abadafdd576d44f3.gif)

This is the `endpoint` simulating a RESTful API (for demo purposes)

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/7/d/7d4599210edccd10fd8e67cf89777d329cdc2482.png)

Here is proof the endpoint works with an external client  
 ![Code_uBn6XKTpuT](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/2/b/2b87c7e34ca16fcad0ead1cb9c61ac523d964b85.gif)

Here is the flow (import using `CTRL-I)...

```auto
[{"id":"59760c9d.172d94","type":"http in","z":"bdd21bc1feae09d1","name":"","url":"/document","method":"post","upload":true,"swaggerDoc":"","x":320,"y":660,"wires":[["712bae2ef6258e81"]]},{"id":"54f2edb5.62fca4","type":"http response","z":"bdd21bc1feae09d1","name":"","statusCode":"","headers":{},"x":1450,"y":660,"wires":[]},{"id":"c6242caa.8ec63","type":"comment","z":"bdd21bc1feae09d1","name":"Simulate the POST endpoint that expects multipart form data","info":"","x":460,"y":580,"wires":[]},{"id":"82d3e2daa98ea06f","type":"inject","z":"bdd21bc1feae09d1","name":"Good post, accept JSON","props":[{"p":"payload"},{"p":"payload.api_key","v":"SECRET_KEY","vt":"str"},{"p":"payload.document_id","v":"doc123","vt":"str"},{"p":"headers['Accept']","v":"application/json","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{}","payloadType":"json","x":370,"y":100,"wires":[["0ac7237dae33d2e6","d115e97827516b1a"]]},{"id":"194ef3c7288651d5","type":"http request","z":"bdd21bc1feae09d1","name":"Post multipart form data","method":"POST","ret":"txt","paytoqs":"ignore","url":"http://localhost:1881/document","tls":"","persist":false,"proxy":"","authType":"","senderr":false,"headers":[{"keyType":"Content-Type","keyValue":"","valueType":"multipart/form-data","valueValue":""}],"x":950,"y":140,"wires":[["c05e1e3cbf72d093"]]},{"id":"3c5189df59054f42","type":"debug","z":"bdd21bc1feae09d1","name":"Answer","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1180,"y":220,"wires":[]},{"id":"712bae2ef6258e81","type":"function","z":"bdd21bc1feae09d1","name":"check / process / respond","func":"const key = msg.payload.api_key\nconst docId = msg.payload.document_id\nif (!docId) {\n throw new Error('document_id is missing')\n}\nif (key != \"SECRET_KEY\") {\n msg.statusCode = 401 // denied\n return msg\n}\n\n// ensure document id is \"doc\" followed by 1 \n// or more numbers e.g. doc123\nif (! /doc\\d+/.test(docId)) {\n msg.statusCode = 400 // bad request\n return msg\n}\nmsg.req_headers = {data: msg.req.headers}\nmsg.msg_headers = {data: msg.headers}\nmsg.payload = {\n valid: true,\n data: {\n document_id: docId\n }\n}\n\nreturn msg","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":550,"y":660,"wires":[["1d901b4b317f8f7c","ecf5d707a79f1eda"]]},{"id":"ecf5d707a79f1eda","type":"debug","z":"bdd21bc1feae09d1","name":"debug 150","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":510,"y":700,"wires":[]},{"id":"d115e97827516b1a","type":"debug","z":"bdd21bc1feae09d1","name":"This is what the payload should look like","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":400,"y":60,"wires":[]},{"id":"0ac7237dae33d2e6","type":"function","z":"bdd21bc1feae09d1","name":"Prepare multipart payload","func":"const formData = msg.payload\n\nmsg.payload = {\n api_key: {\n value: formData.api_key || ''\n },\n document_id: {\n value: formData.document_id || ''\n },\n}\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":690,"y":140,"wires":[["194ef3c7288651d5"]]},{"id":"693c378330eb2a15","type":"switch","z":"bdd21bc1feae09d1","name":"200 \\n 400 \\n 401 \\n other","property":"statusCode","propertyType":"msg","rules":[{"t":"eq","v":"200","vt":"num"},{"t":"eq","v":"400","vt":"num"},{"t":"eq","v":"401","vt":"num"},{"t":"else"}],"checkall":"true","repair":false,"outputs":4,"x":650,"y":380,"wires":[["d7fc6ee3757cb401"],["5be560bfd667133d"],["a1181219613e6562"],["e811a3191f935841"]]},{"id":"5be560bfd667133d","type":"debug","z":"bdd21bc1feae09d1","name":"Bad Data","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"[\t \"statusCode: \" & statusCode\t ,\"payload: \" & payload\t]","targetType":"jsonata","statusVal":"","statusType":"auto","x":860,"y":380,"wires":[]},{"id":"a1181219613e6562","type":"debug","z":"bdd21bc1feae09d1","name":"Wrong API Key","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"[\t \"statusCode: \" & statusCode\t ,\"payload: \" & payload\t]","targetType":"jsonata","statusVal":"","statusType":"auto","x":880,"y":420,"wires":[]},{"id":"e811a3191f935841","type":"debug","z":"bdd21bc1feae09d1","name":"Unknown","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"[\t \"statusCode: \" & statusCode\t ,\"payload: \" & payload\t]","targetType":"jsonata","statusVal":"","statusType":"auto","x":860,"y":460,"wires":[]},{"id":"152455e3bd029bcc","type":"inject","z":"bdd21bc1feae09d1","name":"Bad API KEY","props":[{"p":"payload"},{"p":"payload.api_key","v":"BAD_KEY","vt":"str"},{"p":"payload.document_id","v":"doc123","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{}","payloadType":"json","x":330,"y":200,"wires":[["0ac7237dae33d2e6"]]},{"id":"a915d3517ba8cc25","type":"inject","z":"bdd21bc1feae09d1","name":"bad document ID","props":[{"p":"payload"},{"p":"payload.api_key","v":"SECRET_KEY","vt":"str"},{"p":"payload.document_id","v":"docABC","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{}","payloadType":"json","x":340,"y":240,"wires":[["0ac7237dae33d2e6"]]},{"id":"b6c1a198b53ee540","type":"inject","z":"bdd21bc1feae09d1","name":"bad data","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{}","payloadType":"json","x":320,"y":280,"wires":[["0ac7237dae33d2e6"]]},{"id":"a24465bb8b2b5b52","type":"catch","z":"bdd21bc1feae09d1","name":"","scope":["712bae2ef6258e81","1d901b4b317f8f7c","c7530bbcca12631d","110d532e1e46df8f","f7de9f090d8f6a38","a2ccb3d767345708","6b3b4684e24c2a86"],"uncaught":false,"x":1150,"y":600,"wires":[["bb0ce0682ddf23bd"]]},{"id":"d7fc6ee3757cb401","type":"switch","z":"bdd21bc1feae09d1","name":"JSON? \\n XML?","property":"headers[\"content-type\"]","propertyType":"msg","rules":[{"t":"cont","v":"json","vt":"str"},{"t":"cont","v":"xml","vt":"str"},{"t":"else"}],"checkall":"true","repair":false,"outputs":3,"x":880,"y":280,"wires":[["be01b8754060a568"],["d8fab5ec64ea501b"],["25f5bcd5f0cdea0b"]]},{"id":"be01b8754060a568","type":"json","z":"bdd21bc1feae09d1","name":"","property":"payload","action":"","pretty":false,"x":1050,"y":220,"wires":[["3c5189df59054f42"]]},{"id":"d8fab5ec64ea501b","type":"xml","z":"bdd21bc1feae09d1","name":"","property":"payload","attr":"","chr":"","x":1050,"y":280,"wires":[["6d8d5a2b1bd6697a"]]},{"id":"6d8d5a2b1bd6697a","type":"debug","z":"bdd21bc1feae09d1","name":"Answer","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1180,"y":280,"wires":[]},{"id":"1d901b4b317f8f7c","type":"switch","z":"bdd21bc1feae09d1","name":"JSON? \\n XML? \\n text","property":"req.headers.accept","propertyType":"msg","rules":[{"t":"cont","v":"json","vt":"str"},{"t":"cont","v":"xml","vt":"str"},{"t":"else"}],"checkall":"false","repair":false,"outputs":3,"x":780,"y":660,"wires":[["110d532e1e46df8f"],["c7530bbcca12631d"],["f7de9f090d8f6a38"]]},{"id":"c7530bbcca12631d","type":"xml","z":"bdd21bc1feae09d1","name":"","property":"payload","attr":"","chr":"","x":950,"y":680,"wires":[["6b3b4684e24c2a86"]]},{"id":"f7de9f090d8f6a38","type":"json","z":"bdd21bc1feae09d1","name":"","property":"payload","action":"","pretty":false,"x":950,"y":720,"wires":[["a2ccb3d767345708"]]},{"id":"a2ccb3d767345708","type":"change","z":"bdd21bc1feae09d1","name":"set content type json (string)","rules":[{"t":"set","p":"headers[\"content-type\"]","pt":"msg","to":"application/json","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1160,"y":720,"wires":[["54f2edb5.62fca4"]]},{"id":"110d532e1e46df8f","type":"change","z":"bdd21bc1feae09d1","name":"set content type json (object)","rules":[{"t":"set","p":"headers[\"content-type\"]","pt":"msg","to":"application/json","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1020,"y":640,"wires":[["54f2edb5.62fca4"]]},{"id":"6b3b4684e24c2a86","type":"change","z":"bdd21bc1feae09d1","name":"set content type xml","rules":[{"t":"set","p":"headers[\"content-type\"]","pt":"msg","to":"application/xml","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1140,"y":680,"wires":[["54f2edb5.62fca4"]]},{"id":"593e8c3372094553","type":"inject","z":"bdd21bc1feae09d1","name":"Good post. accept XML","props":[{"p":"payload"},{"p":"payload.api_key","v":"SECRET_KEY","vt":"str"},{"p":"payload.document_id","v":"doc123","vt":"str"},{"p":"headers['Accept']","v":"application/xml","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{}","payloadType":"json","x":360,"y":140,"wires":[["0ac7237dae33d2e6"]]},{"id":"25f5bcd5f0cdea0b","type":"debug","z":"bdd21bc1feae09d1","name":"Answer","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1180,"y":340,"wires":[]},{"id":"c05e1e3cbf72d093","type":"link out","z":"bdd21bc1feae09d1","name":"link out 1","mode":"link","links":["6abe1ded39bce6bc"],"x":1095,"y":140,"wires":[]},{"id":"6abe1ded39bce6bc","type":"link in","z":"bdd21bc1feae09d1","name":"link in 1","links":["c05e1e3cbf72d093"],"x":565,"y":380,"wires":[["693c378330eb2a15"]]},{"id":"ab404d496523a798","type":"comment","z":"bdd21bc1feae09d1","name":"HTTP Request with form data ....","info":"","x":750,"y":60,"wires":[]},{"id":"bb0ce0682ddf23bd","type":"change","z":"bdd21bc1feae09d1","name":"status 500","rules":[{"t":"set","p":"statusCode","pt":"msg","to":"500","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":1290,"y":600,"wires":[["54f2edb5.62fca4"]]},{"id":"3da04a7bdbee4a71","type":"comment","z":"bdd21bc1feae09d1","name":"IMPORTANT: You will need to change the URL ↑ HERE ↑ to match your system","info":"","x":860,"y":180,"wires":[]}]

```

---

<div class="post-metadata">

**Author:** ![nit-cyber](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/nit-cyber/32/72630_2.png) [@nit-cyber](https://discourse.nodered.org/u/nit-cyber)\
**Post date:** [16 December 2022 14:21 UTC](https://discourse.nodered.org/t/http-post-multipart-form-data-via-msg-payload/72250/18 "2022-12-16T14:21:08Z")

</div>

s  
thanks let me try this i will update

---

<div class="post-metadata">

**Author:** ![nit-cyber](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/nit-cyber/32/72630_2.png) [@nit-cyber](https://discourse.nodered.org/u/nit-cyber)\
**Post date:** [16 December 2022 15:36 UTC](https://discourse.nodered.org/t/http-post-multipart-form-data-via-msg-payload/72250/19 "2022-12-16T15:36:58Z")

</div>

can we use change node instead of inject node as url to be varied

---

<div class="post-metadata">

**Author:** ![nit-cyber](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/nit-cyber/32/72630_2.png) [@nit-cyber](https://discourse.nodered.org/u/nit-cyber)\
**Post date:** [16 December 2022 15:37 UTC](https://discourse.nodered.org/t/http-post-multipart-form-data-via-msg-payload/72250/20 "2022-12-16T15:37:34Z")

</div>

form data is filling it is working but same issue of making it dynamic

---

<div class="post-metadata">

**Author:** ![nit-cyber](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/nit-cyber/32/72630_2.png) [@nit-cyber](https://discourse.nodered.org/u/nit-cyber)\
**Post date:** [16 December 2022 15:42 UTC](https://discourse.nodered.org/t/http-post-multipart-form-data-via-msg-payload/72250/22 "2022-12-16T15:42:59Z")

</div>

I have two workflows and need to merge in one  
one workflow gives the uploading file urls  
other workflow will give new url for redirect  
both will merge and make a file to be uploaded at end point

---

<div class="post-metadata">

**Author:** ![nit-cyber](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/nit-cyber/32/72630_2.png) [@nit-cyber](https://discourse.nodered.org/u/nit-cyber)\
**Post date:** [16 December 2022 15:54 UTC](https://discourse.nodered.org/t/http-post-multipart-form-data-via-msg-payload/72250/25 "2022-12-16T15:54:03Z")

</div>

when apikey and workflowid is given the new url is generated  
this new url is needed to give another http request with file url  
after this the file gets uploaded it is mandatory as it is two step process so need two requests also

[Next page](https://discourse.nodered.org/t/http-post-multipart-form-data-via-msg-payload/72250.md?page=2)
