In order to be a bit more clear.
This is what I'm doing.
with
curl http://localhost:1880/flows
i grab every flow I have at the moment.
Then i search for the Id I need and with
curl http://localhost:1880/flow/9aa2a361.a29db
I double check that the flow grabbed is the right one.
Then just for testing purpose i grab the flow
{"id":"9aa2a361.a29db","label":"TEST","info":"","nodes":[{"id":"b52a315e.f2082","type":"inject","z":"9aa2a361.a29db","name":"Pippo","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":230,"y":220,"wires":[["ecac16f5.111b48"]]},{"id":"ecac16f5.111b48","type":"debug","z":"9aa2a361.a29db","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":570,"y":260,"wires":[]}]}
I then tryed sending back the same flow or a new one with the inject name changed from Gigi (original) to another one like Pippo.
I use this
curl -X PUT -H "Content-Type: application/json" -d '{"id":"9aa2a361.a29db","label":"TEST","info":"","nodes":[{"id":"b52a315e.f2082","type":"inject","z":"9aa2a361.a29db","name":"Pippo","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":230,"y":220,"wires":[["ecac16f5.111b48"]]},{"id":"ecac16f5.111b48","type":"debug","z":"9aa2a361.a29db","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":570,"y":260,"wires":[]}]}' http://localhost:1880/flow/9aa2a361.a29db
Then I've noticed two things.
The first is that if i use the -H "Content-Type: application/json"
I get this error
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Error</title>
</head>
<body>
<pre>SyntaxError: Unexpected token # in JSON at position 0<br> at JSON.parse (<anonymous>)<br> at createStrictSyntaxError (c:\Jobs\Dev\Node\node_modules\node-red\node_modules\body-parser\lib\types\json.js:157:10)<br> at parse (c:\Jobs\Dev\Node\node_modules\node-red\node_modules\body-parser\lib\types\json.js:83:15)<br> at c:\Jobs\Dev\Node\node_modules\node-red\node_modules\body-parser\lib\read.js:121:18<br> at invokeCallback (c:\Jobs\Dev\Node\node_modules\node-red\node_modules\raw-body\index.js:224:16)<br> at done (c:\Jobs\Dev\Node\node_modules\node-red\node_modules\raw-body\index.js:213:7)<br> at IncomingMessage.onEnd (c:\Jobs\Dev\Node\node_modules\node-red\node_modules\raw-body\index.js:273:7)<br> at emitNone (events.js:106:13)<br> at IncomingMessage.emit (events.js:208:7)<br> at endReadableNT (_stream_readable.js:1056:12)</pre>
</body>
</html>
If I don't use the -H "Content-Type: application/json"
part, I get the right resposnse as shown in the documentation with the response being the id of the flow: {"id":"9aa2a361.a29db"}
Then the node red flow updates and ask me to check before merging. Then what I see is that everything is deleted, like if I'm leaving blank the -d''.
I don't know if I'm missing something. Is the first time I got a problem like that