when I execute a normal curl via a shell script functioniert es.
This work:
curl -s -v -X POST --data '{
"zoneConfig": {
"userID": "'$userid'",
"name": "'$myName'",
"id":"'$id'"
},
"delete": [
{
"id": "ID1"
},
{
"id": "ID2"
}
]
}' https://urlToAPI
But as soon as I put "delete" in a variable I get an undefined error from the API vendor
This is not working
delete='{
"id": "ID1"
},
{
"id": "ID2"
}'
curl -s -v -X POST --data '{
"zoneConfig": {
"userID": "'$userid'",
"name": "'$myName'",
"id":"'$id'"
},
"delete": [
'$deleteValues'
]
}' https://urlToAPI
But I don't understand the difference as both configurations are the same?
-trace-ascii dump.txtto the command line and check that file after you've run your command...--datawrong (quote issues?) so that curl interpreted that sequence as the URL instead of post content.-X POSTit makes my head hurt.