A restful api has to use either get, post, put or delete request methods. The behavaiour and data submitted is entirely determined by the uri string. No query paramters or post variables.
Is this true ?
Valid : http://example.com/foo/84
Not valid : http://example.com/foo/?value=84
Valid :
$.ajax({
type: 'POST',
url: "http://example.com/foo/84",
success: success,
dataType: dataType
});
Not valid :
$.ajax({
type: 'POST',
url: "http://example.com/foo/",
data: 84,
success: success,
dataType: dataType
});
edit
Two answers so far, and the contradict each other.
Saying that
http://example.com/foo/?value=84is not valid is not entireley true. What i mean is that as long that it is a valid URL it will work and you’ll be able to get the parameters via get or post.On the other hand, REST is an architecture and one of its demands is a clean URL (one that does not include params with a ‘?’) so such a url is not considered a REST like URL.
So if you intend to build a REST based application, you should only use clean urls.
EDIT:
I see from the comments below you have a problem understanding what is REST so i’ll try to give a simple example:
http://example.com/foo/84as a get request and the rest FW knows to get resource foo with id 84.http://example.com/foo/84as a POST request and now the Rest FW know that since its a post request it will call the method responsible for handling post and not the one for handling getSo, although you have the same URL it really matters if its a GET/POST/PUT/DELETE request.