API PUT request

Hello, sorry if this could be a basic/stupid question.

I need to make put and get request using NODE-RED API in order to change something in the flow. While the GET and DELETE works fine, I have some problems with the PUT request. What I'm writing is:
curl -X PUT -H "Content-Type: application/json" -d'MY_NEW_FLOW' URL
The problem is that I am receiving the correct response (The flow ID) but instead of updating the flow everything is erased. Like if I'm not posting any data at all.

What I'm missing here?
Sorry for the touble.

You don't say which api you are using. Is it /flows or /flow ?
What format is your flow data in?

I'm making the update using
/flow/:id

as data I'm putting
-d'{"id":"9aa2a361.a29db","label":"TEST","info":"","nodes":[{"id":"b52a315e.f2082","type":"inject","z":"9aa2a361.a29db","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":240,"y":160,"wires":[["ecac16f5.111b48"]]},{"id":"ecac16f5.111b48","type":"debug","z":"9aa2a361.a29db","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":500,"y":200,"wires":[]}]}'

That is the flow I got with the curl http://127.0.0.1:1880/flow/9aa2a361.a29db

Just to be clear, the PUT url you are using is actually http://127.0.0.1:1880/flow/9aa2a361.a29db with the flow id substituted for the :id placeholder, right?

Yes right

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> &nbsp; &nbsp;at JSON.parse (&lt;anonymous&gt;)<br> &nbsp; &nbsp;at createStrictSyntaxError (c:\Jobs\Dev\Node\node_modules\node-red\node_modules\body-parser\lib\types\json.js:157:10)<br> &nbsp; &nbsp;at parse (c:\Jobs\Dev\Node\node_modules\node-red\node_modules\body-parser\lib\types\json.js:83:15)<br> &nbsp; &nbsp;at c:\Jobs\Dev\Node\node_modules\node-red\node_modules\body-parser\lib\read.js:121:18<br> &nbsp; &nbsp;at invokeCallback (c:\Jobs\Dev\Node\node_modules\node-red\node_modules\raw-body\index.js:224:16)<br> &nbsp; &nbsp;at done (c:\Jobs\Dev\Node\node_modules\node-red\node_modules\raw-body\index.js:213:7)<br> &nbsp; &nbsp;at IncomingMessage.onEnd (c:\Jobs\Dev\Node\node_modules\node-red\node_modules\raw-body\index.js:273:7)<br> &nbsp; &nbsp;at emitNone (events.js:106:13)<br> &nbsp; &nbsp;at IncomingMessage.emit (events.js:208:7)<br> &nbsp; &nbsp;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

You didn't mention which server type or OS you are on, but I suspect that JSON syntax is being mangled by your shell's command line processing (specifically, "globbing") -- for example, certain shells/cli options expand curly braces to locate matching filenames.

You might try to use the curl --globoff ... option to disable globbing, or even the --data-raw argument. But first I would PUT the data to an http in endpoint node linked to a debug node set to "show the complete msg object", where I could see everything that is being passed in by the curl command.