Wednesday 2 January 2013

How to test REST

Test GET

Get foo with id equal to 1:
 curl -i -X GET -H "Accept: application/json" 
-H "Content-Type: application/json" 
http://localhost:8080/server/foo/1

Test POST

Create a new foo:
curl -i -X POST -H "Accept: application/json" 
-H "Content-Type: application/json" --data @foo.json 
http://localhost:8080/server/foo/create
where foo.json:
{"id":1, "name":"foo name"}

No comments:

Post a Comment