Sunday, October 26, 2014

command line - Send HTTP request with parameters file

My question is very simple : is it possible to send a HTTP request from the *nix command line specifying a file, containing all the parameters, as an argument?


In REST APIs documentation, we often see that kind of specification


POST /oauth/token HTTP/1.1
Host: api.example.com
Content-Type: application/x-www-form-urlencoded
grant_type=password
&client_id=
&client_secret=
&username=
&password=

To avoid command lines that are very long and uneasy to edit, is it possible to put these informations in a file, in the above-mentioned format (which seems pretty standard) ? Ideally something with curl that would look like


curl --input-file myparameters.txt

I could not find such feature in curl documentation. Maybe with another command line tool? Thanks in advance.

No comments:

Post a Comment

linux - How to SSH to ec2 instance in VPC private subnet via NAT server

I have created a VPC in aws with a public subnet and a private subnet. The private subnet does not have direct access to external network. S...