Curl Rest Examples:

GET

curl -X GET -H "Content-Type:application/xml" "http://localhost:8080/some/path/505?username=foo&password=bar"

Create

curl -X PUT -H "Accept: *" -d @someFile.xml "http://localhost:8080/some/path?username=foo&password=bar"

Create or Update

curl -X POST -H "Content-Type:application/xml" -d @someFile.xml "http://localhost:8080/some/path/save?username=foo&password=bar"

Delete

curl -X DELETE -H 'Content-Type:application/xml' -d @someFile.xml "http://localhost:8080/some/path?username=foo&password=bar"

Upload file

curl -X PUT -H 'Content-Type:multipart/form-data' -F "someFile.csv=@someFile.csv;type=text/csv" "http://localhost:8080/some/path/505?username=foo&password=bar" --verbose

Download file

curl -H "Accept: *" "http://localhost:8080/some/path/506?username=foo&password=bar" --O "foo.bar" --verbose

0 comments: