cURL to REST API

More curl goodness:

curl -i -X PUT -H "Content-Type:application/json" \
http://localhost//restserver/index.php/api/key \
-d '{"level":10}'

curl -i -X PUT -H "Content-Type:application/json" \
http://localhost//restserver/index.php/api/example/send \
-d '{"username":"me","password":"1234","level":10}'

using a file as input:

curl -i -X PUT -H "Content-Type:application/json" \
http://localhost//restserver/index.php/api/key \
-d @filename.json

Comments

  1. use the -w(--write-out) flag to add a newline after stdout:

    -w '\n'

    ReplyDelete

Post a Comment

Popular posts from this blog

VMware Fusion bridge not working

bash nav