Created
September 25, 2012 18:34
-
-
Save jbrisbin/3783608 to your computer and use it in GitHub Desktop.
Sample REST shell interaction
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
+-( restsh ):> bin/restsh | |
___ ___ __ _____ __ _ _ _ _ __ | |
| _ \ __/' _/_ _/' _/| || | / / | \ \ | |
| v / _|`._`. | | `._`.| >< | / / / > > | |
|_|_\___|___/ |_| |___/|_||_| |_/_/ /_/ | |
Welcome to the REST shell. For assistance hit TAB or type "help". | |
http://localhost:8080:> discover | |
rel href | |
======================================================== | |
child http://localhost:8080/child | |
address http://localhost:8080/address | |
family http://localhost:8080/family | |
parent http://localhost:8080/parent | |
customerTracker http://localhost:8080/customerTracker | |
customer http://localhost:8080/customer | |
peeps http://localhost:8080/people | |
profile http://localhost:8080/profile | |
http://localhost:8080:> baseUri people | |
Base URI set to 'http://localhost:8080/people' | |
http://localhost:8080/people:> discover | |
rel href | |
=================================================== | |
peeps.Person http://localhost:8080/people/1 | |
peeps.Person http://localhost:8080/people/2 | |
peeps.Person http://localhost:8080/people/3 | |
peeps.Person http://localhost:8080/people/4 | |
peeps.search http://localhost:8080/people/search | |
http://localhost:8080/people:> get 1 | |
> GET http://localhost:8080/people/1 | |
< 200 OK | |
< Date: Tue, 25 Sep 2012 18:31:48 GMT | |
< ETag: "2" | |
< Content-Length: 391 | |
< Content-Type: application/json | |
< Server: Jetty(8.1.5.v20120716) | |
< | |
{ | |
"links" : [ { | |
"rel" : "self", | |
"href" : "http://localhost:8080/people/1" | |
}, { | |
"rel" : "peeps.Person.profiles", | |
"href" : "http://localhost:8080/people/1/profiles" | |
}, { | |
"rel" : "peeps.Person.addresses", | |
"href" : "http://localhost:8080/people/1/addresses" | |
}, { | |
"rel" : "added-link", | |
"href" : "http://localhost:8080/people" | |
} ], | |
"name" : "John Doe" | |
} | |
http://localhost:8080/people:> header --name Accept --value application/x-spring-data-compact+json | |
{ | |
"Accept" : "application/x-spring-data-compact+json" | |
} | |
http://localhost:8080/people:> get | |
> GET http://localhost:8080/people/ | |
> Accept: application/x-spring-data-compact+json | |
< 200 OK | |
< Date: Tue, 25 Sep 2012 18:32:16 GMT | |
< Content-Length: 546 | |
< Content-Type: application/json | |
< Server: Jetty(8.1.5.v20120716) | |
< | |
{ | |
"links" : [ { | |
"rel" : "peeps.Person", | |
"href" : "http://localhost:8080/people/1" | |
}, { | |
"rel" : "peeps.Person", | |
"href" : "http://localhost:8080/people/2" | |
}, { | |
"rel" : "peeps.Person", | |
"href" : "http://localhost:8080/people/3" | |
}, { | |
"rel" : "peeps.Person", | |
"href" : "http://localhost:8080/people/4" | |
}, { | |
"rel" : "peeps.search", | |
"href" : "http://localhost:8080/people/search" | |
} ], | |
"content" : [ ], | |
"page" : { | |
"size" : 20, | |
"totalElements" : 4, | |
"totalPages" : 1, | |
"number" : 1 | |
} | |
} | |
http://localhost:8080/people:> post --data "{name:"Janice Doe"}" | |
> POST http://localhost:8080/people/ | |
> Accept: application/x-spring-data-compact+json | |
< 201 CREATED | |
< Date: Tue, 25 Sep 2012 18:32:41 GMT | |
< Location: http://localhost:8080/people/5 | |
< Content-Length: 0 | |
< Content-Type: application/x-spring-data-compact+json | |
< Server: Jetty(8.1.5.v20120716) | |
< | |
http://localhost:8080/people:> get 5 | |
> GET http://localhost:8080/people/5 | |
> Accept: application/x-spring-data-compact+json | |
< 200 OK | |
< Date: Tue, 25 Sep 2012 18:32:43 GMT | |
< ETag: "0" | |
< Content-Length: 393 | |
< Content-Type: application/json | |
< Server: Jetty(8.1.5.v20120716) | |
< | |
{ | |
"links" : [ { | |
"rel" : "peeps.Person.addresses", | |
"href" : "http://localhost:8080/people/5/addresses" | |
}, { | |
"rel" : "self", | |
"href" : "http://localhost:8080/people/5" | |
}, { | |
"rel" : "peeps.Person.profiles", | |
"href" : "http://localhost:8080/people/5/profiles" | |
}, { | |
"rel" : "added-link", | |
"href" : "http://localhost:8080/people" | |
} ], | |
"name" : "Janice Doe" | |
} | |
http://localhost:8080/people:> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment