Curl - Encode file as url query
I'm trying to send message to Amazon SQS
queue with payload read from file using curl
So far I've got working curl to send message to queue but with harcoded value like:
curl --request POST \
--url 'http://localhost:9324/queue/price-import?Action=SendMessage&MessageBody=%7B%0A%09%22id%22%3A%20%22f23399af-a384-4ed3-bac0-386a01804d83%22%2C%0A%09%22de%22%3A%20%7B%0A%09%09%22price%22%3A%2010.59%0A%09%7D%2C%0A%09%22nl%22%3A%20%7B%0A%09%09%22price%22%3A%20107.99%0A%09%7D%2C%0A%09%22pl%22%3A%20%7B%0A%09%09%22price%22%3A%2012.15%0A%09%7D%0A%7D'
And payload I send is:
{
"id": "f23399af-a384-4ed3-bac0-386a01804d83",
"de": {
"price": 10.59
},
"nl": {
"price": 107.99
},
"pl": {
"price": 12.15
}
}
How can I modify this curl to omit harcoded value and instead put path to file with .json
extension?
Desired output
curl --request POST \
--data-urlencode http://localhost:9324/queue/price-import?Action=SendMessage&MessageBody=@input.json
What I already tried
curl --request POST -data-urlencode http://localhost:9324/queue/price-import?Action=SendMessage&MessageBody=@input.json
curl --request POST -data-urlencode input.json http://localhost:9324/queue/price-import
curl --request POST -data-urlencode "sendbody@input.json" http://localhost:9324/queue/price-import
curl --request POST --data-urlencode SendBody@input.json --url http://localhost:9324/queue/price-import?Action=SendMessage