rest - How to specify a parameter in an HTTP GET request -
i developing rest api , make request retrieves in json format user specified "username", like:
{ id: "559d7ced2de324e22a78998b" firstname: "fname" lastname: "flast" username: "testpassword" password: "testusername" address: "123 road" city: "washington dc" state: "california" zipcode: "2345" phonenumber: "234523452345" email: "email@gmail.com" }
the path /users, like: http://localhost:8080/users
my question is, how make request call specifies username.
is this: http://localhost:8080/users/?username=testusername
?
this java method. using spring rest:
/* user username */ @requestmapping(method=requestmethod.get, value="{username}") public user getuserbyusername(@pathvariable string username) { return repo.findbyusername(username); }
it right format http://localhost:8080/users?username=testusername
if have more 1 parameter write
http://localhost:8080/users?username=testusername&email=email_address
Comments
Post a Comment