Curl Command (Linux)

$ curl http://teamonewebapiusage.azurewebsites.net/api/products
[{“Id”:1,”Name”:”Tomato Soup”,”Category”:”Groceries”,”Price”:1.0},{“Id”:2,”Name”:”Yo-yo”,”Category”:”Toys”,”Price”:3.75},{“Id”:3,”Name”:”Hammer”,”Category”:”Hardware”,”Price”:16.99}]

$ curl http://teamonewebapiusage.azurewebsites.net/api/products/3
{“Id”:3,”Name”:”Hammer”,”Category”:”Hardware”,”Price”:16.99}

 

Some more examples:

 

 

 

  • When we use curl at the command line to access websites, the traffic doesn’t show up in Fiddler. This is because curl doesn’t use the system proxy by default.  Try this:

 

 

Example from the Decision Service Web API

  • $ curl -x 127.0.0.1:8888 -H “Content-Type: application/json” -X POST -d @data.json http://localhost:29074/api/decision
    {“Action”:4,”EventId”:”26808b79af3741169863168040109301″,”TimeStamp”:”2016-02-18T09:16:20.2329418Z”}

 

Reference:

[1]  http://www.yilmazhuseyin.com/blog/dev/curl-tutorial-examples-usage/

[2] http://stackoverflow.com/questions/14978411/http-post-and-get-using-curl-in-linux

[3] http://stackoverflow.com/questions/18352190/why-i-get-411-length-required-error

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s