So I figured it out how to upload a file to the ninox api and the key is not to use the Ninox Contrib Node at all, because its broken! Also it uploads to the records file attchement tab not into a specific image field
My function-Node recieves a buffer in msg.payload from a file-in-Node and returns to a http-request-Node
msg.url = "https://api.ninoxdb.de/v1/teams/:teamid/databases/:databaseid/tables/:tableid/records/:recordid/files";
msg.method = "POST";
msg.headers = {"Authorization": "Bearer " + "YOUR-API-KEY-HERE",'Content-Type': "multipart/form-data"};
msg.payload = {
'FormData' : {
//Buffer from file-in-Node
'value': msg.payload,
'options': {
'filename': "filename.pdf"
}
}};
A working flow to import as JSON:
[{"id":"46e2124ef0b032b9","type":"http request","z":"d773eee8.2943e","name":"POST Files","method":"use","ret":"bin","paytoqs":"ignore","url":"","tls":"","persist":false,"proxy":"","authType":"bearer","x":870,"y":2420,"wires":[["2e9fa724e3a7e3a3"]]},{"id":"5494131661011d09","type":"function","z":"d773eee8.2943e","name":"","func":"nRecords = \"RECORD-ID\";\nnTables = \"TABLE-ID\";\nnDatabases = \"DATABASE-ID\";\nnTeams = \"TEAM-ID\";\nnAPI = \"https://api.ninoxdb.de/v1/teams/\";\napiURL = nAPI+nTeams+\"/databases/\"+nDatabases+\"/tables/\"+nTables+\"/records/\"+nRecords+\"/files/\";\n//https://api.ninoxdb.de/v1/teams/:teamid/databases/:databaseid/tables/:tableid/records/:recordid/files\n\nmsg.url = apiURL;\nmsg.method = \"POST\";\nmsg.headers = {\"Authorization\": \"Bearer \" + \"YOUR-API-KEY-HERE\",'Content-Type': \"multipart/form-data\"};\n\nmsg.payload = {\n 'FormData' : {\n //Buffer from file-in-Node\n 'value': msg.payload,\n 'options': {\n 'filename': \"filename.pdf\"\n }\n }};\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":755,"y":2420,"wires":[["46e2124ef0b032b9"]],"icon":"font-awesome/fa-cloud-upload","l":false,"info":"////////////////////////////////////////////////////////////////////////////////////\n//FunktionstĂĽchtiger Code!\nmsg.filename = \"Anhang3.pdf\";\nnRecords = \"23\";\nnTables = \"L\";\nnDatabases = \"ndvkova6gr27\";\nnTeams = \"jmv4Qv6D5X7kPsh7N\";\nnAPI = \"https://api.ninoxdb.de/v1/teams/\";\napiURL = nAPI+nTeams+\"/databases/\"+nDatabases+\"/tables/\"+nTables+\"/records/\"+nRecords+\"/files/\";//+msg.filename;\n//https://api.ninoxdb.de/v1/teams/:teamid/databases/:databaseid/tables/:tableid/records/:recordid/files/:filename\n//https://api.ninoxdb.de/v1/teams/jmv4Qv6D5X7kPsh7N/databases/ndvkova6gr27/tables/L/records/23/files/Anhang1.pdf\";\n\nflow.set('Ninox-API-Key-01', \"21354ea0-dc78-11eb-9129-1bb5351801b2\")\n\nmsg.url = apiURL;\nmsg.method = \"POST\";\nmsg.headers = {\"Authorization\": \"Bearer \" + flow.get(\"Ninox-API-Key-01\"),'Content-Type': \"multipart/form-data\"};\n\nmsg.payload = {\n 'FormData' : {\n 'value': msg.payload,\n 'options': {\n 'filename': msg.filename\n }\n }};\n\nreturn msg;\n////////////////////////////////////////////////////////////////////////////////////"},{"id":"121516c0c58b41ef","type":"inject","z":"d773eee8.2943e","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payloadType":"date","x":635,"y":2420,"wires":[["6a1e012078a5d140"]],"icon":"font-awesome/fa-power-off","l":false},{"id":"2e9fa724e3a7e3a3","type":"debug","z":"d773eee8.2943e","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":975,"y":2420,"wires":[],"l":false},{"id":"6a1e012078a5d140","type":"file in","z":"d773eee8.2943e","name":"","filename":"./load/testfile/here.pdf","format":"","chunk":false,"sendError":false,"encoding":"none","allProps":false,"x":695,"y":2420,"wires":[["5494131661011d09"]],"l":false}]