In Node-RED, it has "Document uploder node", which sounds can upload file to Discovery Service, but, the problem is my client want to upload .doc file. Of course I tried, but Discovery service side treat the payload as json and cannot got expected result...
- I attached Node-RED flow' json as js snippet, can reproduce the problem
- Just FYI also attached the upload result Document upload result
Please let me know if some can help me ...
Thank you, Sincerely :)
[
{
"id": "e4faba0c.56b178",
"type": "watson-discovery-v1-document-loader",
"z": "638c0f19.4d555",
"name": "",
"environment_id": "170e0fd8-d7f2-4486-8bd6-6c987162961c",
"collection_id": "8c517d38-164d-415c-9137-5ff5ac08a391",
"filename": "myword.doc",
"default-endpoint": false,
"service-endpoint": "https://gateway-fra.watsonplatform.net/discovery/api",
"x": 580,
"y": 500,
"wires": [
[
"6e29e3ac.0bd18c"
]
]
},
{
"id": "f36b9a78.0eb958",
"type": "http in",
"z": "638c0f19.4d555",
"name": "[POST] interface",
"url": "/interface",
"method": "post",
"upload": true,
"swaggerDoc": "",
"x": 100,
"y": 440,
"wires": [
[
"31ec90da.b573d8",
"5220938b.ddb934"
]
]
},
{
"id": "31ec90da.b573d8",
"type": "function",
"z": "638c0f19.4d555",
"name": "reqProcessor",
"func": "msg.payload = msg.req.files[0].buffer;\n\n\n\nreturn msg;",
"outputs": 1,
"noerr": 0,
"x": 290,
"y": 440,
"wires": [
[
"e4faba0c.56b178"
]
]
},
{
"id": "5220938b.ddb934",
"type": "debug",
"z": "638c0f19.4d555",
"name": "",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "req",
"x": 280,
"y": 500,
"wires": []
},
{
"id": "6e29e3ac.0bd18c",
"type": "debug",
"z": "638c0f19.4d555",
"name": "",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "false",
"x": 800,
"y": 600,
"wires": []
}
]