Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to pass arguments to GET method in RESTfull webservice

I have to pass UserName and password as arguments into GET method for validation.after processing I need to get response.so how can I pass value into RESTful webservice GET method?

like image 375
user3543997 Avatar asked Apr 17 '14 12:04

user3543997


People also ask

Can we pass parameter in Get method?

Parameters can be passed in GET Request, if you are not sure how to do a GET Request using Postman, please take a look at the previous article How to make a GET Request.

Can we send parameters in GET request?

Using the params property we can pass parameters to the HTTP get request. Either we can pass HttpParams or an object which contains key value pairs of parameters. Let's go through an example to understand it further.

How do you pass data in GET method?

get( url, [data], [callback], [type] ) method loads data from the server using a GET HTTP request. data − This optional parameter represents key/value pairs that will be sent to the server. callback − This optional parameter represents a function to be executed whenever the data is loaded successfully.


1 Answers

To pass parameters in HTTP GET you should use a ? delimiter. Such as

https://mywebsite.com/user/login?username=bob&password=123
https://mywebsite.com/user/login?paramname1=value1&paramname2=value2

Make sure to always use https with any sensitive data. You may also need to escape/encode both username and password to allow extended ASCII. If you need to support UNICODE you should consider using a POST request.

like image 91
oleksii Avatar answered Oct 24 '22 10:10

oleksii