Hello, @MutedJam I believe our conversation is moving in a different direction; perhaps I am not making myself clear. I am sorry if I caused any confusion earlier. I am making it much simpler to read.
I would like to send all the data from the code node in the formData
format. Specifically, I want to send the “attachment” attribute as binary data.
Please let me know how I can achieve this. Once more, I am sending you a screenshot of the code node and the http node, where I have added a binary parameter and a key as an “attachment[]”. However, the main issue is what I should add to its value. I want to pass the value of “attachment”, which I am getting from my previous node, i.e., the code node.
{
“meta”: {
“instanceId”: “f85288737922f7456a98dabca1d0c61e25f3b046c522ce3d3cb84d81ec321dd7”
},
“nodes”: [
{
“parameters”: {
“method”: “POST”,
“url”: “https://shalimarpaints.freshservice.com/api/v2/tickets”,
“authentication”: “genericCredentialType”,
“genericAuthType”: “httpBasicAuth”,
“sendBody”: true,
“contentType”: “multipart-form-data”,
“bodyParameters”: {
“parameters”: [
{
“name”: “description”,
“value”: “={{ $node["mapping data"].json["data"]["description"] }}”
},
{
“name”: “subject”,
“value”: “={{ $node["mapping data"].json["data"]["subject"] }}”
},
{
“name”: “email”,
“value”: “={{ $node["mapping data"].json["data"]["email"] }}”
},
{
“name”: “priority”,
“value”: “={{ $json.data.priority }}”
},
{
“name”: “status”,
“value”: “={{ $json.data.status }}”
},
{
“name”: “workspace_id”,
“value”: “={{ $json.data.workspace_id }}”
},
{
“name”: “custom_fields[lf_ticket_department]”,
“value”: “={{ $json.data.custom_fields.lf_ticket_department }}”
},
{
“name”: “custom_fields[complaints]”,
“value”: “={{ $json.data.custom_fields.complaints }}”
},
{
“name”: “=custom_fields[item_type]”,
“value”: “={{ $json.data.custom_fields.item_type }}”
},
{
“name”: “custom_fields[product_code]”,
“value”: “={{ $json.data.custom_fields.product_code }}”
},
{
“name”: “custom_fields[product_code]”,
“value”: “={{ $json.data.custom_fields.product_code }}”
},
{
“name”: “custom_fields[product_name]”,
“value”: “={{ $json.data.custom_fields.product_name }}”
},
{
“name”: “custom_fields[customer_code]”,
“value”: “={{ $json.data.custom_fields.customer_code }}”
},
{
“name”: “custom_fields[customer_name]”,
“value”: “={{ $json.data.custom_fields.customer_name }}”
},
{
“name”: “custom_fields[beatroute_id]”,
“value”: “={{ $json.data.custom_fields.beatroute_id }}”
},
{
“name”: “custom_fields[batch_number]”,
“value”: “={{ $json.data.custom_fields.batch_number }}”
},
{
“name”: “custom_fields[manufacturing_date]”,
“value”: “={{ $json.data.custom_fields.manufacturing_date }}”
},
{
“name”: “custom_fields[damaged_quantity]”,
“value”: “={{ $json.data.custom_fields.damaged_quantity }}”
},
{
“name”: “custom_fields[retailer_br_id]”,
“value”: “={{ $json.data.custom_fields.retailer_br_id }}”
},
{
“name”: “custom_fields[beatroute_id]”,
“value”: “={{ $json.data.custom_fields.beatroute_id }}”
},
{
“name”: “custom_fields[item_type]”,
“value”: “={{ $json.data.custom_fields.item_type }}”
},
{
“name”: “custom_fields[lf_ticket_department]”,
“value”: “={{ $json.data.custom_fields.lf_ticket_department }}”
},
{
“name”: “cc_emails”,
“value”: “={{ $json.data.cc_emails }}”
},
{
“parameterType”: “formBinaryData”,
“name”: “attachments[]”
}
]
},
“options”: {}
},
“id”: “1628770e-b321-481b-8307-be5ccc499448”,
“name”: “HTTP Request”,
“type”: “n8n-nodes-base.httpRequest”,
“typeVersion”: 4.1,
“position”: [
-120,
940
],
“credentials”: {
“httpBasicAuth”: {
“id”: “117”,
“name”: “Freshservice”
}
}
},
{
“parameters”: {
“jsCode”: “var data = {\n "data": {\n "subject": "Brush Mark",\n "attachments": "20230630_1688106262392.jpg",\n "description": "test",\n "email": "[email protected]",\n "cc_emails": [],\n "priority": 2,\n "workspace_id": 2,\n "status": 2,\n "custom_fields": {\n "lf_ticket_department": "27000440761",\n "item_type": "Decorative",\n "complaints": "Brush Mark",\n "product_code": "50004054020000",\n "product_name": "THINNER FOR ANTIBRINE AL.THIN.6754 INDL P C 20 LT",\n "batch_number": "check",\n "manufacturing_date": "2023-06-30",\n "damaged_quantity": "1",\n "customer_code": "E404O04401",\n "customer_name": "Apurwatest-Dealer",\n "beatroute_id": "8051",\n "retailer_br_id": "5638431"\n }\n }}\n\nreturn data”
},
“id”: “78c2fa4d-3b78-46db-a309-844ec14aa251”,
“name”: “Code”,
“type”: “n8n-nodes-base.code”,
“typeVersion”: 1,
“position”: [
-380,
960
]
}
],
“connections”: {
“Code”: {
“main”: [
[
{
“node”: “HTTP Request”,
“type”: “main”,
“index”: 0
}
]
]
}
}
}