Trying to update data from a system using curl and url/token, but I am running into the following error. I believe the way I format the curl command in the shell script is incorrect but not sure how to fix it.
curl: (3) URL rejected: Malformed input to a URL function
When I run the curl command from terminal with the value, it is successful and the fields get updated.
curl -X 'PATCH'
'https://myurl/123'
Ran the shell script below.
#!/bin/bash
while read line
do
line='${line%$cr}'
curl -X 'PATCH'
'https://myurl/${line}'
-H 'accept: */*'
-H 'Authorization: Bearer user:TOKEN'
-H 'Content-Type: application/json;odata.metadata=minimal;odata.streaming=true'
-d '[
{
"path": "/field1",
"value": "10"
},
{
"path": "/field2",
"value": "200"
}
]'
done < list.txt
list.txt contains
123
234
456
3