Add a pet:
$ curl -H "Content-Type: application/json" -d '{ "name": "Manny", "species": "Cat" }' http://localhost:3000/add_pet
List pets
$ curl http://localhost:3000/get_pets
[
{
"name": "Tobi",
"species": "Ferret"
},
{
"name": "Loki",
"species": "Ferret"
},
{
"name": "Jane",
"species": "Ferret"
},
{
"name": "Manny",
"species": "Cat"
}
]
Remove a bunch:
$ curl -H "Content-Type: application/json" -d '{ "name": "Tobi" }' http://localhost:3000/remove_pet
$ curl -H "Content-Type: application/json" -d '{ "name": "Loki" }' http://localhost:3000/remove_pet
$ curl -H "Content-Type: application/json" -d '{ "name": "Jane" }' http://localhost:3000/remove_pet
List again:
$ curl -H "Content-Type: application/json" -d '{ "name": "Manny", "species": "Cat" }' http://localhost:3000/add_pet
[
{
"name": "Manny",
"species": "Cat"
}
]
Invalid method:
$ curl http://localhost:3000/hello
Method is not defined on the service, must be one of: add_pet, remove_pet, get_pets